Repository navigation
A refused Apply or structure insert says which node cannot be read, and why - #656
Merged
Merged
Conversation
…nd why InvalidRevisionContentError carries its cause (a non-finite number and where, an unreadable model node with the reader's reason, a model node in a version 1 document, an unknown kind) and a message for it. validateResultGraph and the structure insert's backstop give that reason instead of the non-finite sentence for every cause. Part of #619.
Deploying cozy-loop-studio with
|
| Latest commit: |
0e356e8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c86521f8.cozy-loop-studio.pages.dev |
| Branch Preview URL: | https://register-refusal-names-cause.cozy-loop-studio.pages.dev |
5 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #619 (item 5, the last item; the revision export and data import messages are left as a follow-up, see below).
What was wrong
A hand-edited or damaged file can hold a model node that cannot be read. Opening keeps such a node as written; the editor cannot write one, since the Register field commits only text that parses. Measured on main
8e4c5b02:expr42… node r (register): expr is not a stringexpr1 +… node r (register): expr does not parse: "1 +"value"abc"… node p (parameter): value is not a numberinitialInfinity (control)… node inf data.initialTwo catches dropped the cause:
validateResultGraph, which selective Apply and the data import commit use, and the structure insert's backstop. The error's own message also began "non-finite number in revision content at" for every cause but an unknown kind.The change
InvalidRevisionContentErrorcarriescontentCause, a field named so as not to shadow the standardError.cause:Its message now says that cause.
invalidContentReason(e)gives the refusal reason in model-layer English, like the other reasons:It holds no stack and no error class name.
validateResultGraphandinsertGraph's backstop use it.An error of another class keeps the old sentence, as before.
Where it shows:
Left out, as agreed: a follow-up
Naming the node there needs a new catalog key in every language. It will be listed on #619 as a separate scope. (The data import's internal
detail.reasonsnow carries the new reason, but the wizard does not show it.)Tests (
src/model/invalidContentReason.test.ts), written firstEach of the four cases checks the thrown message,
validateResultGraph's reasons andinsertGraph's reason:A fifth test checks that no reason holds a stack frame, a file name or an error class name.
On main's code the four case tests fail and the fifth passes. For the control, only the reason fails: the message was already right. With the change all five pass.
Checks
npx tsc -b: clean.npm run lint: 88 warnings, the baseline.check:*scripts: pass.What it touches