Errors now have better pretty printing. We infer component names when possible. We produce a "stack trace" of the path from the root to the location of the error message. We provide objects for each kind of error message to avoid duplication of error message strings. We provide better formatting for error messages.
We do this by introducing a new error context, pushing errors to that context, and adding a callback when errors are pushed. We don't currently do anything with the error array itself, but we might in the future and it was easy enough to create so I just left it in.
We can optionally add a toast so that errors render on the screen instead of just in the dev console. This is not implemented in this PR.
This removes all console.errors except the one root one and the one in text processing. All thrown errors are unchanged for now.
The diff looks larger than it is because adding displayName changed indentation levels in various places.
Errors now conform to the BluefishError interface:
Errors now have better pretty printing. We infer component names when possible. We produce a "stack trace" of the path from the root to the location of the error message. We provide objects for each kind of error message to avoid duplication of error message strings. We provide better formatting for error messages.
We do this by introducing a new error context, pushing errors to that context, and adding a callback when errors are pushed. We don't currently do anything with the error array itself, but we might in the future and it was easy enough to create so I just left it in.
We can optionally add a
toast
so that errors render on the screen instead of just in the dev console. This is not implemented in this PR.This removes all
console.error
s except the one root one and the one in text processing. All thrown errors are unchanged for now.The diff looks larger than it is because adding
displayName
changed indentation levels in various places.Errors now conform to the
BluefishError
interface:The
source
is the scenegraph node where the error originated.resolveScopeName
is a function used to try to turn layout id's into scope names.The error message format is the following:
The source is displayed, then the custom error message, then the error type. Finally, we present the path from the scenegraph root to the source node.
Example
Given this spec:
We will receive the following error message