Skip to content

Commit

Permalink
Merge pull request #414 from atsign-foundation/exeption_invalid_enrol…
Browse files Browse the repository at this point in the history
…lment_status

feat: add new error code and description for 'Invalid Enrollment Status'
  • Loading branch information
srieteja authored Sep 29, 2023
2 parents 9a3abc0 + 92aad8a commit b8f8af8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions packages/at_commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.0.56
- feat: Introduce "AtInvalidEnrollmentException" which is thrown when an enrollment is expired or invalid
- feat: Introduce error code 'AT0030' for Invalid Enrollment Status
## 3.0.55
- feat: Introduce "AtThrottleLimitExceeded" exception which is thrown when enrollment request exceeds the limit
- feat: Introduce new error codes for apkam enrollments
Expand Down
5 changes: 5 additions & 0 deletions packages/at_commons/lib/src/exception/at_exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ class AtEnrollmentException extends AtException {
AtEnrollmentException(message) : super(message);
}

/// Exception thrown when an Enrollment_id is expired or invalid
class AtInvalidEnrollmentException extends AtException {
AtInvalidEnrollmentException(message) : super(message);
}

/// Exception thrown when the enrollment requests exceed the limit
/// in the given time window
class AtThrottleLimitExceeded extends AtException {
Expand Down
8 changes: 5 additions & 3 deletions packages/at_commons/lib/src/exception/error_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const Map error_codes = {
'IllegalArgumentException': 'AT0022',
'AtTimeoutException': 'AT0023',
'ServerIsPausedException': 'AT0024',
'AtThrottleLimitException': 'AT0028'
'AtThrottleLimitException': 'AT0028',
'AtInvalidEnrollmentException': 'AT0029',
};

// ignore: constant_identifier_names
Expand Down Expand Up @@ -50,6 +51,7 @@ const Map error_description = {
'AT0025': 'Apkam Auth Denied',
'AT0026': 'Apkam Auth Failed',
'AT0027': 'Apkam Access Revoked',
'AT0028': 'Apkam Enrollment Expired',
'AT0029': 'Too Many Requests'
'AT0028': 'Too Many Requests',
'AT0029': 'Apkam Enrollment Expired',
'AT0030': 'Invalid Enrollment Status'
};
2 changes: 1 addition & 1 deletion packages/at_commons/lib/src/verb/operation_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum MessageTypeEnum { key, text }
String getMessageType(MessageTypeEnum? messageTypeEnum) =>
'$messageTypeEnum'.split('.').last;

enum EnrollOperationEnum { request, approve, deny, revoke, list }
enum EnrollOperationEnum { request, approve, deny, revoke, list, update }

String getEnrollOperation(EnrollOperationEnum? enrollOperationEnum) =>
'$enrollOperationEnum'.split('.').last;
2 changes: 1 addition & 1 deletion packages/at_commons/lib/src/verb/syntax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class VerbSyntax {
static const notifyRemove = r'notify:remove:(?<id>[\w\d\-\_]+)';
static const enroll =
// The non-capturing group (?::)? matches ":" if the operation is request|approve|deny|revoke
r'^enroll:(?<operation>(?:list$|(request|approve|deny|revoke)))(?::)?(?<enrollParams>.+)?$';
r'^enroll:(?<operation>(?:list$|(request|approve|deny|revoke|update)))(?::)?(?<enrollParams>.+)?$';
static const otp = r'^otp:(?<operation>get|validate)(:(?<otp>\w+))?$';
static const keys = r'^keys:((?<operation>put|get|delete):?)'
r'(?:(?<visibility>public|private|self):?)?'
Expand Down
2 changes: 1 addition & 1 deletion packages/at_commons/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_commons
description: A library of Dart and Flutter utility classes that are used across other components of the atPlatform.
version: 3.0.55
version: 3.0.56
repository: https://github.com/atsign-foundation/at_libraries
homepage: https://atsign.dev

Expand Down

0 comments on commit b8f8af8

Please sign in to comment.