Skip to content

Commit

Permalink
chore: add all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jahabeebs committed Sep 19, 2024
1 parent 418fe77 commit dfcc7dc
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 81 deletions.
275 changes: 272 additions & 3 deletions packages/automated-dispute/src/exceptions/errorFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const errorStrategiesEntries: [string, ErrorHandlingStrategy][] = [
[
"ValidatorLib_InvalidResponseBody",
{
shouldNotify: true,
shouldTerminate: true,
shouldConsume: false,
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
Expand Down Expand Up @@ -56,6 +56,25 @@ const errorStrategiesEntries: [string, ErrorHandlingStrategy][] = [
},
},
],
[
"Oracle_InvalidDispute",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
customAction: async (context) => {
context.registry.removeDispute(context.dispute.id);
},
},
],
[
"Oracle_InvalidDisputeBody",
{
shouldNotify: true,
shouldTerminate: true,
shouldConsume: false,
},
],
[
"Oracle_AlreadyFinalized",
{
Expand All @@ -66,12 +85,262 @@ const errorStrategiesEntries: [string, ErrorHandlingStrategy][] = [
],
[
"EBORequestModule_InvalidRequester",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"EBORequestModule_ChainNotAdded",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"EBORequestCreator_InvalidEpoch",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_InvalidRequestBody",
{
shouldNotify: true,
shouldTerminate: true,
shouldConsume: false,
},
],
[
"EBORequestCreator_RequestAlreadyCreated",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_InvalidRequest",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"Oracle_InvalidResponseBody",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"AccountingExtension_NotAllowed",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"BondedResponseModule_AlreadyResponded",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondedResponseModule_TooLateToPropose",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_CannotEscalate",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Validator_InvalidDispute",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
customAction: async (context) => {
context.registry.removeDispute(context.dispute.id);
},
},
],
[
"ValidatorLib_InvalidDisputeBody",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
customAction: async (context) => {
context.registry.removeDispute(context.dispute.id);
},
},
],
[
"EBOFinalityModule_InvalidRequester",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"Oracle_InvalidFinalizedResponse",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_InvalidResponse",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_FinalizableResponseExists",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"ArbitratorModule_InvalidArbitrator",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
customAction: async (context) => {
context.registry.removeDispute(context.dispute.id);
},
},
],
[
"AccountingExtension_UnauthorizedModule",
{
shouldNotify: true,
shouldTerminate: true,
shouldConsume: false,
},
],
[
"BondEscalationModule_NotEscalatable",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_BondEscalationNotOver",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_BondEscalationOver",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_DisputeWindowOver",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_ResponseAlreadyDisputed",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_CannotBreakTieDuringTyingBuffer",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_CanOnlySurpassByOnePledge",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_MaxNumberOfEscalationsReached",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"Oracle_NotDisputeOrResolutionModule",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
},
],
[
"BondEscalationModule_ShouldBeEscalated",
{
shouldNotify: true,
shouldTerminate: false,
shouldConsume: false,
// Custom action to escalate dispute is implemented in eboActor.ts
},
],
[
"BondEscalationModule_BondEscalationCantBeSettled",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
[
"BondEscalationModule_BondEscalationNotOver",
{
shouldNotify: false,
shouldTerminate: false,
shouldConsume: true,
},
],
];

const errorStrategies = new Map<string, ErrorHandlingStrategy>(errorStrategiesEntries);
Expand Down
Loading

0 comments on commit dfcc7dc

Please sign in to comment.