-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Property Editor] Handle errors from the Analysis Server #8818
Changes from 4 commits
93737c2
f58c474
c1394bf
57089dd
ff72e62
8bb823a
bf86128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,7 +216,7 @@ mixin _PropertyInputMixin<T extends StatefulWidget, U> on State<T> { | |
|
||
final value = property.convertFromInputString(valueAsString) as U?; | ||
final response = await controller.editArgument(name: argName, value: value); | ||
_maybeHandleServerError(response, property: property); | ||
_maybeHandleServerError(response); | ||
} | ||
|
||
InputDecoration decoration( | ||
|
@@ -270,32 +270,11 @@ mixin _PropertyInputMixin<T extends StatefulWidget, U> on State<T> { | |
}); | ||
} | ||
|
||
void _maybeHandleServerError( | ||
EditArgumentResponse? errorResponse, { | ||
required EditableProperty property, | ||
}) { | ||
void _maybeHandleServerError(EditArgumentResponse? errorResponse) { | ||
if (errorResponse == null || errorResponse.success) return; | ||
setState(() { | ||
_serverError = _errorMessage(errorResponse.errorType, property: property); | ||
_serverError = | ||
errorResponse.errorType?.message ?? 'Encountered unknown error.'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still want to include the property in this error message? I think it would be helpful: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
}); | ||
} | ||
|
||
String _errorMessage( | ||
EditArgumentError? errorType, { | ||
required EditableProperty property, | ||
}) { | ||
final propertyName = property.name; | ||
switch (errorType) { | ||
case EditArgumentError.editArgumentInvalidParameter: | ||
return 'Invalid parameter: $propertyName.'; | ||
case EditArgumentError.editArgumentInvalidPosition: | ||
return 'Invalid position for parameter: $propertyName.'; | ||
case EditArgumentError.editArgumentInvalidValue: | ||
return 'Invalid value for parameter: $propertyName.'; | ||
case EditArgumentError.editsUnsupportedByEditor: | ||
return 'IDE does not support property edits.'; | ||
default: | ||
return 'Encountered unknown error editing ${property.name}.'; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle size is now 1552kb, therefore bumping 1550 limit to 1650