errors.ts 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. export type JoystreamLibErrorType =
  2. | 'ApiNotConnectedError'
  3. | 'UnknownError'
  4. | 'FailedError'
  5. | 'SignCancelledError'
  6. | 'AccountNotSelectedError'
  7. | 'MissingRequiredEventError'
  8. | 'MetaprotocolTransactionError'
  9. | 'AccountBalanceTooLow'
  10. | 'ChannelExcludedError'
  11. // ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low,
  12. type JoystreamLibErrorArgs = {
  13. name: JoystreamLibErrorType
  14. message?: string
  15. details?: unknown
  16. }
  17. export enum ErrorCode {
  18. NftAuctionIsAlreadyExpired = 'NftAuctionIsAlreadyExpired', // English auction already expired
  19. BidStepConstraintViolated = 'BidStepConstraintViolated', // Somebody placed a higher bid in english auction already
  20. IsNotOpenAuctionType = 'IsNotOpenAuctionType', // Auction is not open, open auction winner has been picked before your bid has been processed
  21. IsNotEnglishAuctionType = 'IsNotEnglishAuctionType', // - Somebody already bought NFT or somebody has settled an auction already
  22. BidDoesNotExist = 'BidDoesNotExist', // Auction does not have bids, as an NFT owner, I want to pick open auction winner, but they have withdrawn their bid
  23. InvalidBuyNowPriceProvided = 'InvalidBuyNowPriceProvided', // Buy now price is invalid, buy now price has changed after you wanted to buy it
  24. ActorNotAuthorized = 'ActorNotAuthorized', // Actor is not authorized to perform this action, as an NFT owner, I want to cancel my open auction but somebody has used buy now on it
  25. ActionHasBidsAlready = 'ActionHasBidsAlready', // Already active auction cannot be cancelled, as an NFT owner, I want to cancel my english auction but somebody has placed a bid
  26. NftNotInBuyNowState = 'NftNotInBuyNowState', // Somebody already bought NFT (buy now)
  27. LiquidityRestrictions = 'LiquidityRestrictions', // Transfer dialog('Account liquidity restrictions prevent withdrawal'). You can't transfer because you don't have enough tokens to pay fee.
  28. WithdrawFromChannelAmountExceedsBalanceMinusExistentialDeposit = 'WithdrawFromChannelAmountExceedsBalanceMinusExistentialDeposit', // Withdraw dialog('An attempt to withdraw funds from channel account failed, because the specified amount, exceeds the account's balance minus ExistantialDeposit'). You can't withdraw because you don't have enough tokens(this includes fee)
  29. DataObjectStateBloatBondChanged = 'DataObjectStateBloatBondChanged', // Data state bloat bond changed
  30. VideoStateBloatBondChanged = 'VideoStateBloatBondChanged', // video state bloat bond changed
  31. ChannelStateBloatBondChanged = 'ChannelStateBloatBondChanged', // video state bloat bond changed
  32. InsufficientBalance = 'InsufficientBalance', // balance to low to send tokens
  33. InsufficientBalanceForChannelCreation = 'InsufficientBalanceForChannelCreation', // Cannot create the channel: channel creator has insufficient balance, (budget for channel state bloat bond + channel data objs state bloat bonds + data objs storage fees))
  34. InsufficientBalanceForVideoCreation = ' InsufficientBalanceForVideoCreation,', /// Cannot create the video: video creator has insufficient balance, (budget for video state bloat bond + video data objs state bloat bonds + data objs storage fees)
  35. }
  36. // More error codes https://github.com/Joystream/joystream/blob/master/runtime-modules/content/src/errors.rs
  37. export class JoystreamLibError extends Error {
  38. name: JoystreamLibErrorType
  39. details: unknown
  40. constructor({ name, message, details }: JoystreamLibErrorArgs) {
  41. super(message)
  42. this.name = name
  43. this.details = details
  44. }
  45. }