Skip to content

Commit

Permalink
Remove deprecated APIs from dart:developer
Browse files Browse the repository at this point in the history
Contributes to bug: #34233

Change-Id: I18f12b8c8da2ec444911128b96111e93df6c0496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251767
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
  • Loading branch information
mit-mit authored and Commit Bot committed Jul 19, 2022
1 parent 09680ec commit e15d639
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,15 @@ breaking changes:

#### `dart:developer`

- **Breaking change** [#34233][]: The previously deprecated APIs
`kInvalidParams`, `kExtensionError`, `kExtensionErrorMax`, and
`kExtensionErrorMin` in [`ServiceExtensionResponse`][] have been removed. They
have been replaced by `invalidParams`, `extensionError`, `extensionErrorMax`,
and `extensionErrorMin`.

[#34233]: https://github.com/dart-lang/sdk/issues/34233
[`ServiceExtensionResponse`]: https://api.dart.dev/stable/dart-developer/ServiceExtensionResponse-class.html#constants

- The constructors for `TimelineTask` now accept an optional `filterKey`
parameter. If provided, the arguments for all events associated with the task
will contain an entry named `filterKey`, set to the value of the `filterKey`
Expand Down
8 changes: 4 additions & 4 deletions sdk/lib/_internal/vm/lib/developer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ _runExtension(
} catch (e, st) {
var errorDetails = (st == null) ? '$e' : '$e\n$st';
response = new ServiceExtensionResponse.error(
ServiceExtensionResponse.kExtensionError, errorDetails);
ServiceExtensionResponse.extensionError, errorDetails);
_postResponse(replyPort, id, response, trace_service);
return;
}
if (response is! Future) {
response = new ServiceExtensionResponse.error(
ServiceExtensionResponse.kExtensionError,
ServiceExtensionResponse.extensionError,
"Extension handler must return a Future");
_postResponse(replyPort, id, response, trace_service);
return;
Expand All @@ -103,13 +103,13 @@ _runExtension(
// Catch any errors eagerly and wrap them in a ServiceExtensionResponse.
var errorDetails = (st == null) ? '$e' : '$e\n$st';
return new ServiceExtensionResponse.error(
ServiceExtensionResponse.kExtensionError, errorDetails);
ServiceExtensionResponse.extensionError, errorDetails);
}).then((response) {
// Post the valid response or the wrapped error after verifying that
// the response is a ServiceExtensionResponse.
if (response is! ServiceExtensionResponse) {
response = new ServiceExtensionResponse.error(
ServiceExtensionResponse.kExtensionError,
ServiceExtensionResponse.extensionError,
"Extension handler must complete to a ServiceExtensionResponse");
}
_postResponse(replyPort, id, response, trace_service);
Expand Down
16 changes: 0 additions & 16 deletions sdk/lib/developer/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ class ServiceExtensionResponse {
checkNotNullable(errorDetail, "errorDetail");
}

/// Invalid method parameter(s) error code.
@deprecated
static const kInvalidParams = invalidParams;

/// Generic extension error code.
@deprecated
static const kExtensionError = extensionError;

/// Maximum extension provided error code.
@deprecated
static const kExtensionErrorMax = extensionErrorMax;

/// Minimum extension provided error code.
@deprecated
static const kExtensionErrorMin = extensionErrorMin;

/// Invalid method parameter(s) error code.
static const invalidParams = -32602;

Expand Down
8 changes: 4 additions & 4 deletions tests/lib/fix_data_tests/developer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import 'dart:developer';

void main() {
print(ServiceExtensionResponse.kInvalidParams);
print(ServiceExtensionResponse.kExtensionError);
print(ServiceExtensionResponse.kExtensionErrorMax);
print(ServiceExtensionResponse.kExtensionErrorMin);
print(ServiceExtensionResponse.invalidParams);
print(ServiceExtensionResponse.extensionError);
print(ServiceExtensionResponse.extensionErrorMax);
print(ServiceExtensionResponse.extensionErrorMin);
}

0 comments on commit e15d639

Please sign in to comment.