Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions contracts/src/dispute_error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use soroban_sdk::contracterror;

#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[repr(u32)]
pub enum DisputeError {
/// Cannot auto-refund yet
DisputeWindowNotElapsed = 500,
/// Dispute already exists for session
DisputeAlreadyOpen = 501,
/// No open dispute to resolve
DisputeNotOpen = 502,
/// Session not eligible for resolution
ResolutionNotAllowed = 503,
}

impl From<DisputeError> for u32 {
fn from(error: DisputeError) -> Self {
error as u32
}
}
4 changes: 4 additions & 0 deletions src/common/exceptions/error-codes.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export enum ErrorCodes {
NOT_ADMIN = 201, // Caller is not contract admin
NOT_BUYER = 202, // Caller is not session buyer
NOT_SELLER = 203, // Caller is not session seller
DISPUTE_WINDOW_NOT_ELAPSED = 500, // Cannot auto-refund yet
DISPUTE_ALREADY_OPEN = 501, // Dispute already exists for session
DISPUTE_NOT_OPEN = 502, // No open dispute to resolve
RESOLUTION_NOT_ALLOWED = 503, // Session not eligible for resolution
FORBIDDEN = 'FORBIDDEN',
BAD_REQUEST = 'BAD_REQUEST',
INTERNAL_ERROR = 'INTERNAL_ERROR',
Expand Down