terriajs icon indicating copy to clipboard operation
terriajs copied to clipboard

[EPIC] Error handling

Open tephenavies opened this issue 5 years ago • 14 comments

On master we handle errors through terria.error Cesium event showing a dialogue for each error. Since the preview map has it's own Terria it can handle preview-related errors and just change the caption text.

We need to redesign this. One option is for each catalog item to have it's own event where errors are sent to. The workbench would then listen to catalog items that are on the bench, and the preview map listen to those on the preview map. What about loading groups in the catalogue or querying metadata from a WMS?

tephenavies avatar Jun 12 '19 02:06 tephenavies

Perhaps also various levels of verbosity/notify-user-ness, & put the useful-to-know-but-don't-show-it-in-my-face into a "( ! )" kind of icon somewhere that opens up maybe?

soyarsauce avatar Oct 15 '19 00:10 soyarsauce

We should just use this...

type Value<T> = T & {__warning__?: string}

nf-s avatar Jul 08 '20 04:07 nf-s

A proposal put through is to start a "bucket of errors" property on the terria mobx model and start putting things in there to get us started

soyarsauce avatar Jul 08 '20 04:07 soyarsauce

Investigate why the following gives no errors:

{
  "name": "A",
  "type": "my-type",
  ...,
  "featureInfoTemplate": {
    "template": "a feature {{feat_name}}.\n{{desc}}",
    "partial": {
      "desc": "This is a {{feat_type}}"
    }
  }
}

The misspelling of partials as partial results in none of the featureInfoTemplate traits are present.

tephenavies avatar Jul 13 '20 03:07 tephenavies

I have had a similar experience with other objectTraits - for example - CSV trait polling

nf-s avatar Jul 13 '20 05:07 nf-s

Also, it would be nice to get type errors for mismatched type property:

@primitiveTrait({
    type: "string",
    name: "Allow undefined",
    description: "Allow dimension to be undefined"
  })
  allowUndefined?: boolean;

nf-s avatar Sep 01 '20 02:09 nf-s

Also there are times where Terria will white-screen because of trait issues (like that one above) - and it is nearly impossible to see where the error occurred. It would be nice if we had a really loud error message for trait issues

nf-s avatar Sep 01 '20 02:09 nf-s

If you have an incorrect trait (for example opacity as a string) it will ignore ALL traits after opacity and not give you a warning

eg

{
  "homeCamera": {
    "north": -8,
    "east": 158,
    "south": -45,
    "west": 109
  },
  "catalog": [
    {
      "type": "wms",
      "id": "deacoast",
      "name": "Digital Earth Australia Coastlines",
      "url": "https://geoserver.dea.ga.gov.au/geoserver/wms",
      "opacity": "1.0",
      "layers": "dea:DEACoastLines"
    }
  ],
  "workbench": [
    "deacoast"
  ]
}

will not add layers property

nf-s avatar Sep 27 '20 09:09 nf-s

Meeting notes 22/02/2021:

  • Straight migration from v7 to v8 poses some challenges, such as throwing an error from a pure function (linked to the implicit assumption that the data is correct and able to compute)
  • to avoid throwing errors/warnings from inside a pure function, when something is off but is a guess, you can:
  1. do data validation beforehand
  2. use Sentinel values or fp-ts
  • re-writing the traits system is very complex and it should be avoided, especially if it involves modifying MobX
  • other options could include the use of a global status tree - to have an "error" property to maintain irrespective of how the error is triggered

Steps (in priority order):

  1. In v8, handle the easy cases first: e.g. tile error handling; error boundaries in REACT code
  2. upsert model from JSON
  3. review the current error handling implementation in v7 to understand the overall problem we're trying to solve, especially from an end user perspective. Ana & Phil will need a list of current errors and how they are generated. Examples: when do we throw an error - check the translation.json - search in title log message
  4. Investigate and activate/configure Rollbars in current apps (following the review of errors done at step 3).

AnaBelgun avatar Feb 22 '21 05:02 AnaBelgun

To support "warnings" & errors everywhere in the Traits system we could use a type system like:

class PartialError<T> extends TerriaError {
  partialResult: T;
}

// inside a Traits class
{
  layers: string | undefined | TerriaError;
}

And create helper functions to deal with those (following fp-ts-like principles).

tephenavies avatar Apr 12 '21 14:04 tephenavies

Next steps:

  • Step 1 - error messages for end users (non developers) - curate the message with clear instructions (@AnaBelgun @phil); investigating toast option vs blocking step on landing page
    • https://github.com/TerriaJS/terriajs/pull/5454
  • Step 2 - error boundaries @steve9164

AnaBelgun avatar Apr 28 '21 02:04 AnaBelgun

  • [x] https://github.com/TerriaJS/terriajs/issues/5627

nf-s avatar Jul 14 '21 07:07 nf-s

  • [ ] https://github.com/TerriaJS/terriajs/issues/6007

nf-s avatar Nov 25 '21 05:11 nf-s

  • [ ] https://github.com/TerriaJS/terriajs/issues/6567

nf-s avatar Sep 05 '23 02:09 nf-s