Skip to content

Commit

Permalink
Merge pull request #207 from atsign-foundation/notify_exception_chaining
Browse files Browse the repository at this point in the history
feat: Enhance AtException subclasses optionally to have intent and exception scenario
  • Loading branch information
sitaram-kalluri authored Jul 22, 2022
2 parents b04a1af + 11c2a82 commit 61c548c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions at_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 3.0.20
- Enhance notify verb to include the isEncrypted field
- Add intent and exception scenario to AtException sub-classes
- Introducing class SecureSocketConfig to store config params to create security context for secure sockets.
## 3.0.19
- Rename byPassCache to bypassCache in lookup, plookup verb builders and at_constants
Expand Down
19 changes: 13 additions & 6 deletions at_commons/lib/src/exception/at_exceptions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:at_commons/src/exception/at_exception_stack.dart';
import 'package:at_commons/src/keystore/at_key.dart';
import 'package:at_commons/at_commons.dart';

/// The class [AtException] and its subclasses represents various exceptions that can arise
/// while using the @ protocol.
Expand Down Expand Up @@ -40,7 +39,9 @@ class AtException implements Exception {

/// The class [AtConnectException] and its subclasses represent any issues that prevents an connection to the root or the secondary server
class AtConnectException extends AtException {
AtConnectException(message) : super(message);
AtConnectException(message,
{Intent? intent, ExceptionScenario? exceptionScenario})
: super(message, intent: intent, exceptionScenario: exceptionScenario);
}

/// Exception thrown when there is an issue connecting to root server
Expand Down Expand Up @@ -153,12 +154,16 @@ class InternalServerError extends AtException {
/// Exception thrown when an atsign's secondary url cannot be reached or is unavailable
/// Should this be extending AtConnectException?
class SecondaryConnectException extends AtException {
SecondaryConnectException(message) : super(message);
SecondaryConnectException(message,
{Intent? intent, ExceptionScenario? exceptionScenario})
: super(message, intent: intent, exceptionScenario: exceptionScenario);
}

/// Exception thrown when [AtKey.key] is not present in the keystore
class KeyNotFoundException extends AtException {
KeyNotFoundException(message) : super(message);
KeyNotFoundException(message,
{Intent? intent, ExceptionScenario? exceptionScenario})
: super(message, intent: intent, exceptionScenario: exceptionScenario);
}

/// Exception thrown when any parameter in a verb command is invalid
Expand All @@ -168,7 +173,9 @@ class IllegalArgumentException extends AtException {

/// Exception thrown when no response is received before the timeout duration
class AtTimeoutException extends AtException {
AtTimeoutException(message) : super(message);
AtTimeoutException(message,
{Intent? intent, ExceptionScenario? exceptionScenario})
: super(message, intent: intent, exceptionScenario: exceptionScenario);
}

/// Exception thrown when request to secondary server is invalid
Expand Down

0 comments on commit 61c548c

Please sign in to comment.