From b7c80ad1bdaadd7da14a46ddf83f8696e5af5e1c Mon Sep 17 00:00:00 2001 From: Dillon Nys Date: Wed, 7 Feb 2024 16:09:09 -0800 Subject: [PATCH] chore(core): Make `SerializationException` implement `BadRequestException` When thrown on the server, a serialization exception means that the server received bad data from the client. --- packages/celest_core/CHANGELOG.md | 2 ++ packages/celest_core/lib/src/exception/cloud_exception.dart | 2 +- .../celest_core/lib/src/exception/serialization_exception.dart | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/celest_core/CHANGELOG.md b/packages/celest_core/CHANGELOG.md index 8cbd31e5..a6e852d8 100644 --- a/packages/celest_core/CHANGELOG.md +++ b/packages/celest_core/CHANGELOG.md @@ -1,5 +1,7 @@ ## 0.2.0-dev +- Make `SerializationException` implement `BadRequestException` + ## 0.1.1 - Update README diff --git a/packages/celest_core/lib/src/exception/cloud_exception.dart b/packages/celest_core/lib/src/exception/cloud_exception.dart index 870ec6d8..5d70b198 100644 --- a/packages/celest_core/lib/src/exception/cloud_exception.dart +++ b/packages/celest_core/lib/src/exception/cloud_exception.dart @@ -7,7 +7,7 @@ sealed class CloudException implements CelestException {} /// An exception thrown by a Cloud Function when a request contains invalid /// data or otherwise lead to a recoverable exception. /// {@endtemplate} -final class BadRequestException implements CloudException { +class BadRequestException implements CloudException { /// Creates a [BadRequestException] with the given [message]. /// /// {@macro celest_core_exception_bad_request_exception} diff --git a/packages/celest_core/lib/src/exception/serialization_exception.dart b/packages/celest_core/lib/src/exception/serialization_exception.dart index 2ed31f48..ffb40203 100644 --- a/packages/celest_core/lib/src/exception/serialization_exception.dart +++ b/packages/celest_core/lib/src/exception/serialization_exception.dart @@ -7,7 +7,7 @@ import 'package:celest_core/celest_core.dart'; /// deserialize a value. /// {@endtemplate} final class SerializationException extends FormatException - implements CelestException { + implements BadRequestException, CelestException { /// Creates a [SerializationException] with the given [message]. /// /// {@macro celest_core_exceptions_serialization_exception}