Skip to content

Conversation

@matanlurey
Copy link
Contributor

Closes #130.

I validated internally this produces a nicer error message, such as:

[SEVERE]: Error formatting the generated source code for <REDACTED>|lib/focus_trap.dart which was output to lib/focus_trap.template.dart.
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen if appropriate.
Could not format because the source could not be parsed:

<REDACTED>

Closes #130.

I validated internally this produces a nicer error message, such as:

```
[SEVERE]: Error formatting the generated source code for <REDACTED>|lib/focus_trap.dart which was output to lib/focus_trap.template.dart.
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen if appropriate.
Could not format because the source could not be parsed:
```
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen
if approppriate.""",
''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually put this so the entire rest of the message is not formatted strangely - it's sort of a cludge with dartfmt. I can remove if you like, but then the error message doesn't stick into one paragraph.

This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen
if approppriate.""",
''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank string huh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'Error formatting generated source code for ${library.identifier} '
'which was output to ${_generatedFile(buildStep.inputId).path}.\n'
'This may indicate an issue in the generated code or in the formatter.'
'\n'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using '''...''' for multi-line things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been moving to this format in a lot of places. ''' works best for things like top-level variables where the string doesn't have any long lines

  • let's us break up the String arbitrarily and and separate from how it's broken in the output to fit 80 chars
  • Doesn't introduce a weird jump to the left of the screen from an indented block when the output shouldn't be indented

Copy link
Member

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also – want this internally ASAP?

Do we want to do a +1 in the pubspec + changelog and publish?

@matanlurey
Copy link
Contributor Author

@kevmoo I sent a cooresponding CL to patch this internally.

When you eventually sync, this will safely override it. If that's OK, I'll let you release normally.

@kevmoo
Copy link
Member

kevmoo commented Feb 13, 2017

@matanlurey – hrm...not a good practice to start IMHO – very easy to publish this and do a normal sync...and avoid confusing folks maintaining 3rd-party

@matanlurey
Copy link
Contributor Author

Sure, but we're time sensitive right now. Given that @natebosch supports the package internally too I don't think it's a huge issue. Normally I would just wait for the sync.

@matanlurey matanlurey merged commit a0cb07d into master Feb 13, 2017
@matanlurey matanlurey deleted the patch-error-message branch February 13, 2017 22:04
Please check the generated code and file an issue on source_gen
if approppriate.""",
'''Error formatting generated source code for ${library.identifier}
which was output to ${_generatedFile(buildStep.inputId).path}.\n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We ended up with a bad mix here - we don't need both ''' and \n...

mosuem pushed a commit to dart-lang/build that referenced this pull request Dec 10, 2024
* Add more context about dartfmt failures

Closes dart-lang/source_gen#130.

I validated internally this produces a nicer error message, such as:

```
[SEVERE]: Error formatting the generated source code for <REDACTED>|lib/focus_trap.dart which was output to lib/focus_trap.template.dart.
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen if appropriate.
Could not format because the source could not be parsed:
```

* Update builder.dart
mosuem pushed a commit to dart-lang/build that referenced this pull request Dec 10, 2024
* Add more context about dartfmt failures

Closes dart-lang/source_gen#130.

I validated internally this produces a nicer error message, such as:

```
[SEVERE]: Error formatting the generated source code for <REDACTED>|lib/focus_trap.dart which was output to lib/focus_trap.template.dart.
This may indicate an issue in the generated code or in the formatter.
Please check the generated code and file an issue on source_gen if appropriate.
Could not format because the source could not be parsed:
```

* Update builder.dart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants