-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(satp-hermes): service errors and some stage bugs
Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt> feat(satp-hermes): satp rejection Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt> feat(satp-hermes): handler bug correction and errors Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt> fix(satp-hermes): bridge erros and log messages Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt> fix(satp-hermes): some error fixes Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt> fix(satp-hermes): some fixes requested Signed-off-by: Carlos Amaro <carlosrscamaro@tecnico.ulisboa.pt>
- Loading branch information
1 parent
7da3f27
commit 5744312
Showing
31 changed files
with
1,211 additions
and
2,368 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/cactus-plugin-satp-hermes/cache/solidity-files-cache.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ges/cactus-plugin-satp-hermes/src/main/typescript/blo/admin/get-status-handler-service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors/bridge-erros.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export class BridgeInternalError extends Error { | ||
constructor( | ||
public message: string, | ||
// TODO internal error codes | ||
public code: number = 500, | ||
public traceID?: string, | ||
public trace?: string, | ||
) { | ||
super(message); | ||
this.name = this.constructor.name; | ||
Object.setPrototypeOf(this, new.target.prototype); // make sure prototype chain is set to error | ||
//this.stack = trace || new Error().stack; | ||
} | ||
} | ||
|
||
export class OntologyError extends BridgeInternalError { | ||
constructor(tag: string) { | ||
super( | ||
`${tag}, undefined Ontology, ontology is required to interact with tokens`, | ||
500, | ||
); | ||
} | ||
} | ||
|
||
export class TransactionError extends BridgeInternalError { | ||
constructor(tag: string) { | ||
super(`${tag}, Transaction failed`, 500); | ||
} | ||
} | ||
|
||
export class TransactionIdUndefinedError extends BridgeInternalError { | ||
constructor(tag: string) { | ||
super(`${tag}, Transaction id undefined`, 500); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors/satp-handler-errors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { SATPInternalError } from "./satp-errors"; | ||
|
||
export class SessionNotFoundError extends SATPInternalError { | ||
constructor(tag: string) { | ||
super(`${tag}, session not found`, 500); | ||
} | ||
} | ||
|
||
export class SessionIdNotFoundError extends SATPInternalError { | ||
constructor(tag: string) { | ||
super(`${tag}, session id not found`, 500); | ||
} | ||
} | ||
|
||
export class FailedToCreateMessageError extends SATPInternalError { | ||
constructor(tag: string, message: string) { | ||
super(`${tag}, failed to create message: ${message}`, 500); | ||
} | ||
} | ||
|
||
export class FailedToProcessError extends SATPInternalError { | ||
constructor(tag: string, message: string) { | ||
super(`${tag}, failed to process: ${message}`, 500); | ||
} | ||
} |
168 changes: 168 additions & 0 deletions
168
packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors/satp-service-errors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
import { SATPInternalError } from "./satp-errors"; | ||
|
||
export class SatpCommonBodyError extends SATPInternalError { | ||
constructor(fnTag: string, data: string) { | ||
super( | ||
`${fnTag}, message satp common body is missing or is missing required fields \n ${data}`, | ||
400, | ||
); | ||
} | ||
} | ||
export class SessionError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, session undefined`, 500); | ||
} | ||
} | ||
|
||
export class SessionDataNotLoadedCorrectlyError extends SATPInternalError { | ||
constructor(fnTag: string, data: string) { | ||
super(`${fnTag}, session data was not loaded correctly \n ${data}`, 500); | ||
} | ||
} | ||
|
||
export class SessionCompletedError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, session data already completed`, 500); | ||
} | ||
} | ||
|
||
export class SATPVersionError extends SATPInternalError { | ||
constructor(fnTag: string, unsupported: string, supported: string) { | ||
super( | ||
`${fnTag}, unsupported SATP version \n received: ${unsupported}, supported: ${supported}`, | ||
400, | ||
); | ||
} | ||
} | ||
|
||
export class SignatureVerificationError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, message signature verification failed`, 400); | ||
} | ||
} | ||
|
||
export class SignatureMissingError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, message signature missing`, 400); | ||
} | ||
} | ||
|
||
export class MessageTypeError extends SATPInternalError { | ||
constructor(fnTag: string, received: string, expected: string) { | ||
super( | ||
`${fnTag}, message type miss match \n received: ${received} \n expected: ${expected}`, | ||
400, | ||
); | ||
} | ||
} | ||
|
||
export class TransferInitClaimsError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, transferInitClaims missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class TransferInitClaimsHashError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, transferInitClaims hash missing or missmatch`, 400); | ||
} | ||
} | ||
|
||
export class NetworkCapabilitiesError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, NetworkCapabilitiesError missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class DLTNotSupportedError extends SATPInternalError { | ||
constructor(fnTag: string, dlt: string) { | ||
super(`${fnTag}, DLT not supported \n received: ${dlt}`, 400); | ||
} | ||
} | ||
|
||
export class ServerGatewayPubkeyError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, serverGatewayPubkey missing or missmatch`, 400); | ||
} | ||
} | ||
|
||
export class ClientGatewayPubkeyError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, clientGatewayPubkey missing or missmatch`, 400); | ||
} | ||
} | ||
|
||
export class SequenceNumberError extends SATPInternalError { | ||
constructor(fnTag: string, received: bigint, expected: bigint) { | ||
super( | ||
`${fnTag}, sequence number missmatch \n received: ${received} \n expected: ${expected}`, | ||
400, | ||
); | ||
} | ||
} | ||
|
||
export class HashError extends SATPInternalError { | ||
constructor(fnTag: string, received: string, expected: string) { | ||
super( | ||
`${fnTag}, hash missmatch \n received: ${received} \n expected: ${expected}`, | ||
400, | ||
); | ||
} | ||
} | ||
|
||
export class TransferContextIdError extends SATPInternalError { | ||
constructor(fnTag: string, received: string, expected: string) { | ||
super( | ||
`${fnTag}, transferContextId missing or missmatch \n received: ${received} \n expected: ${expected}`, | ||
400, | ||
); | ||
} | ||
} | ||
|
||
export class MissingBridgeManagerError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, bridge manager missing`, 400); | ||
} | ||
} | ||
|
||
export class LockAssertionClaimError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, lockAssertionClaim missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class LockAssertionClaimFormatError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, lockAssertionClaimFormat missing`, 400); | ||
} | ||
} | ||
|
||
export class LockAssertionExpirationError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, lockAssertionExpiration missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class BurnAssertionClaimError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, burnAssertionClaim missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class MintAssertionClaimError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, mintAssertionClaim missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class AssignmentAssertionClaimError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, assignmentAssertionClaim missing or faulty`, 400); | ||
} | ||
} | ||
|
||
export class ResourceUrlError extends SATPInternalError { | ||
constructor(fnTag: string) { | ||
super(`${fnTag}, resourceUrl missing or missmatch`, 400); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.