mpl_token_metadata/
error.rs

1//! Error types
2
3use num_derive::FromPrimitive;
4use solana_program::{
5    decode_error::DecodeError,
6    msg,
7    program_error::{PrintProgramError, ProgramError},
8};
9use thiserror::Error;
10
11/// Errors that may be returned by the Metadata program.
12#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
13pub enum MetadataError {
14    /// 0 Failed to unpack instruction data
15    #[error("Failed to unpack instruction data")]
16    InstructionUnpackError,
17
18    /// Failed to pack instruction data
19    #[error("Failed to pack instruction data")]
20    InstructionPackError,
21
22    /// Lamport balance below rent-exempt threshold.
23    #[error("Lamport balance below rent-exempt threshold")]
24    NotRentExempt,
25
26    /// Already initialized
27    #[error("Already initialized")]
28    AlreadyInitialized,
29
30    /// Uninitialized
31    #[error("Uninitialized")]
32    Uninitialized,
33
34    ///  Metadata's key must match seed of ['metadata', program id, mint] provided
35    #[error(" Metadata's key must match seed of ['metadata', program id, mint] provided")]
36    InvalidMetadataKey,
37
38    ///  Edition's key must match seed of ['metadata', program id, name, 'edition'] provided
39    #[error("Edition's key must match seed of ['metadata', program id, name, 'edition'] provided")]
40    InvalidEditionKey,
41
42    /// Update Authority given does not match
43    #[error("Update Authority given does not match")]
44    UpdateAuthorityIncorrect,
45
46    /// Update Authority needs to be signer to update metadata
47    #[error("Update Authority needs to be signer to update metadata")]
48    UpdateAuthorityIsNotSigner,
49
50    /// You must be the mint authority and signer on this transaction
51    #[error("You must be the mint authority and signer on this transaction")]
52    NotMintAuthority,
53
54    /// 10 - Mint authority provided does not match the authority on the mint
55    #[error("Mint authority provided does not match the authority on the mint")]
56    InvalidMintAuthority,
57
58    /// Name too long
59    #[error("Name too long")]
60    NameTooLong,
61
62    /// Symbol too long
63    #[error("Symbol too long")]
64    SymbolTooLong,
65
66    /// URI too long
67    #[error("URI too long")]
68    UriTooLong,
69
70    /// Update authority must be equivalent to the metadata's authority and also signer of this transaction
71    #[error("Update authority must be equivalent to the metadata's authority and also signer of this transaction")]
72    UpdateAuthorityMustBeEqualToMetadataAuthorityAndSigner,
73
74    /// Mint given does not match mint on Metadata
75    #[error("Mint given does not match mint on Metadata")]
76    MintMismatch,
77
78    /// Editions must have exactly one token
79    #[error("Editions must have exactly one token")]
80    EditionsMustHaveExactlyOneToken,
81
82    /// Maximum editions printed already
83    #[error("Maximum editions printed already")]
84    MaxEditionsMintedAlready,
85
86    /// Token mint to failed
87    #[error("Token mint to failed")]
88    TokenMintToFailed,
89
90    /// The master edition record passed must match the master record on the edition given
91    #[error("The master edition record passed must match the master record on the edition given")]
92    MasterRecordMismatch,
93
94    /// 20 - The destination account does not have the right mint
95    #[error("The destination account does not have the right mint")]
96    DestinationMintMismatch,
97
98    /// An edition can only mint one of its kind!
99    #[error("An edition can only mint one of its kind!")]
100    EditionAlreadyMinted,
101
102    /// Printing mint decimals should be zero
103    #[error("Printing mint decimals should be zero")]
104    PrintingMintDecimalsShouldBeZero,
105
106    /// OneTimePrintingAuthorizationMint mint decimals should be zero
107    #[error("OneTimePrintingAuthorization mint decimals should be zero")]
108    OneTimePrintingAuthorizationMintDecimalsShouldBeZero,
109
110    /// Edition mint decimals should be zero
111    #[error("EditionMintDecimalsShouldBeZero")]
112    EditionMintDecimalsShouldBeZero,
113
114    /// Token burn failed
115    #[error("Token burn failed")]
116    TokenBurnFailed,
117
118    /// The One Time authorization mint does not match that on the token account!
119    #[error("The One Time authorization mint does not match that on the token account!")]
120    TokenAccountOneTimeAuthMintMismatch,
121
122    /// Derived key invalid
123    #[error("Derived key invalid")]
124    DerivedKeyInvalid,
125
126    /// The Printing mint does not match that on the master edition!
127    #[error("The Printing mint does not match that on the master edition!")]
128    PrintingMintMismatch,
129
130    /// The  One Time Printing Auth mint does not match that on the master edition!
131    #[error("The One Time Printing Auth mint does not match that on the master edition!")]
132    OneTimePrintingAuthMintMismatch,
133
134    /// 30 - The mint of the token account does not match the Printing mint!
135    #[error("The mint of the token account does not match the Printing mint!")]
136    TokenAccountMintMismatch,
137
138    /// The mint of the token account does not match the master metadata mint!
139    #[error("The mint of the token account does not match the master metadata mint!")]
140    TokenAccountMintMismatchV2,
141
142    /// Not enough tokens to mint a limited edition
143    #[error("Not enough tokens to mint a limited edition")]
144    NotEnoughTokens,
145
146    /// The mint on your authorization token holding account does not match your Printing mint!
147    #[error(
148        "The mint on your authorization token holding account does not match your Printing mint!"
149    )]
150    PrintingMintAuthorizationAccountMismatch,
151
152    /// The authorization token account has a different owner than the update authority for the master edition!
153    #[error("The authorization token account has a different owner than the update authority for the master edition!")]
154    AuthorizationTokenAccountOwnerMismatch,
155
156    /// This feature is currently disabled.
157    #[error("This feature is currently disabled.")]
158    Disabled,
159
160    /// Creators list too long
161    #[error("Creators list too long")]
162    CreatorsTooLong,
163
164    /// Creators must be at least one if set
165    #[error("Creators must be at least one if set")]
166    CreatorsMustBeAtleastOne,
167
168    /// If using a creators array, you must be one of the creators listed
169    #[error("If using a creators array, you must be one of the creators listed")]
170    MustBeOneOfCreators,
171
172    /// This metadata does not have creators
173    #[error("This metadata does not have creators")]
174    NoCreatorsPresentOnMetadata,
175
176    /// 40 - This creator address was not found
177    #[error("This creator address was not found")]
178    CreatorNotFound,
179
180    /// Basis points cannot be more than 10000
181    #[error("Basis points cannot be more than 10000")]
182    InvalidBasisPoints,
183
184    /// Primary sale can only be flipped to true and is immutable
185    #[error("Primary sale can only be flipped to true and is immutable")]
186    PrimarySaleCanOnlyBeFlippedToTrue,
187
188    /// Owner does not match that on the account given
189    #[error("Owner does not match that on the account given")]
190    OwnerMismatch,
191
192    /// This account has no tokens to be used for authorization
193    #[error("This account has no tokens to be used for authorization")]
194    NoBalanceInAccountForAuthorization,
195
196    /// Share total must equal 100 for creator array
197    #[error("Share total must equal 100 for creator array")]
198    ShareTotalMustBe100,
199
200    /// This reservation list already exists!
201    #[error("This reservation list already exists!")]
202    ReservationExists,
203
204    /// This reservation list does not exist!
205    #[error("This reservation list does not exist!")]
206    ReservationDoesNotExist,
207
208    /// This reservation list exists but was never set with reservations
209    #[error("This reservation list exists but was never set with reservations")]
210    ReservationNotSet,
211
212    /// This reservation list has already been set!
213    #[error("This reservation list has already been set!")]
214    ReservationAlreadyMade,
215
216    /// 50 - Provided more addresses than max allowed in single reservation
217    #[error("Provided more addresses than max allowed in single reservation")]
218    BeyondMaxAddressSize,
219
220    /// NumericalOverflowError
221    #[error("NumericalOverflowError")]
222    NumericalOverflowError,
223
224    /// This reservation would go beyond the maximum supply of the master edition!
225    #[error("This reservation would go beyond the maximum supply of the master edition!")]
226    ReservationBreachesMaximumSupply,
227
228    /// Address not in reservation!
229    #[error("Address not in reservation!")]
230    AddressNotInReservation,
231
232    /// You cannot unilaterally verify another creator, they must sign
233    #[error("You cannot unilaterally verify another creator, they must sign")]
234    CannotVerifyAnotherCreator,
235
236    /// You cannot unilaterally unverify another creator
237    #[error("You cannot unilaterally unverify another creator")]
238    CannotUnverifyAnotherCreator,
239
240    /// In initial reservation setting, spots remaining should equal total spots
241    #[error("In initial reservation setting, spots remaining should equal total spots")]
242    SpotMismatch,
243
244    /// Incorrect account owner
245    #[error("Incorrect account owner")]
246    IncorrectOwner,
247
248    /// printing these tokens would breach the maximum supply limit of the master edition
249    #[error("printing these tokens would breach the maximum supply limit of the master edition")]
250    PrintingWouldBreachMaximumSupply,
251
252    /// Data is immutable
253    #[error("Data is immutable")]
254    DataIsImmutable,
255
256    /// 60 - No duplicate creator addresses
257    #[error("No duplicate creator addresses")]
258    DuplicateCreatorAddress,
259
260    /// Reservation spots remaining should match total spots when first being created
261    #[error("Reservation spots remaining should match total spots when first being created")]
262    ReservationSpotsRemainingShouldMatchTotalSpotsAtStart,
263
264    /// Invalid token program
265    #[error("Invalid token program")]
266    InvalidTokenProgram,
267
268    /// Data type mismatch
269    #[error("Data type mismatch")]
270    DataTypeMismatch,
271
272    /// Beyond alotted address size in reservation!
273    #[error("Beyond alotted address size in reservation!")]
274    BeyondAlottedAddressSize,
275
276    /// The reservation has only been partially alotted
277    #[error("The reservation has only been partially alotted")]
278    ReservationNotComplete,
279
280    /// You cannot splice over an existing reservation!
281    #[error("You cannot splice over an existing reservation!")]
282    TriedToReplaceAnExistingReservation,
283
284    /// Invalid operation
285    #[error("Invalid operation")]
286    InvalidOperation,
287
288    /// Invalid owner
289    #[error("Invalid Owner")]
290    InvalidOwner,
291
292    /// Printing mint supply must be zero for conversion
293    #[error("Printing mint supply must be zero for conversion")]
294    PrintingMintSupplyMustBeZeroForConversion,
295
296    /// 70 - One Time Auth mint supply must be zero for conversion
297    #[error("One Time Auth mint supply must be zero for conversion")]
298    OneTimeAuthMintSupplyMustBeZeroForConversion,
299
300    /// You tried to insert one edition too many into an edition mark pda
301    #[error("You tried to insert one edition too many into an edition mark pda")]
302    InvalidEditionIndex,
303
304    // In the legacy system the reservation needs to be of size one for cpu limit reasons
305    #[error("In the legacy system the reservation needs to be of size one for cpu limit reasons")]
306    ReservationArrayShouldBeSizeOne,
307
308    /// Is Mutable can only be flipped to false
309    #[error("Is Mutable can only be flipped to false")]
310    IsMutableCanOnlyBeFlippedToFalse,
311
312    #[error("Collection cannot be verified in this instruction")]
313    CollectionCannotBeVerifiedInThisInstruction,
314
315    #[error("This instruction was deprecated in a previous release and is now removed")]
316    Removed, //For the curious we cannot get rid of an instruction in the enum or move them or it will break our api, this is a friendly way to get rid of them
317
318    #[error("This token use method is burn and there are no remaining uses, it must be burned")]
319    MustBeBurned,
320
321    #[error("This use method is invalid")]
322    InvalidUseMethod,
323
324    #[error("Cannot Change Use Method after the first use")]
325    CannotChangeUseMethodAfterFirstUse,
326
327    #[error("Cannot Change Remaining or Available uses after the first use")]
328    CannotChangeUsesAfterFirstUse,
329
330    // 80
331    #[error("Collection Not Found on Metadata")]
332    CollectionNotFound,
333
334    #[error("Collection Update Authority is invalid")]
335    InvalidCollectionUpdateAuthority,
336
337    #[error("Collection Must Be a Unique Master Edition v2")]
338    CollectionMustBeAUniqueMasterEdition,
339
340    #[error("The Use Authority Record Already Exists, to modify it Revoke, then Approve")]
341    UseAuthorityRecordAlreadyExists,
342
343    #[error("The Use Authority Record is empty or already revoked")]
344    UseAuthorityRecordAlreadyRevoked,
345
346    #[error("This token has no uses")]
347    Unusable,
348
349    #[error("There are not enough Uses left on this token.")]
350    NotEnoughUses,
351
352    #[error("This Collection Authority Record Already Exists.")]
353    CollectionAuthorityRecordAlreadyExists,
354
355    #[error("This Collection Authority Record Does Not Exist.")]
356    CollectionAuthorityDoesNotExist,
357
358    #[error("This Use Authority Record is invalid.")]
359    InvalidUseAuthorityRecord,
360
361    // 90
362    #[error("This Collection Authority Record is invalid.")]
363    InvalidCollectionAuthorityRecord,
364
365    #[error("Metadata does not match the freeze authority on the mint")]
366    InvalidFreezeAuthority,
367
368    #[error("All tokens in this account have not been delegated to this user.")]
369    InvalidDelegate,
370
371    #[error("Creator can not be adjusted once they are verified.")]
372    CannotAdjustVerifiedCreator,
373
374    #[error("Verified creators cannot be removed.")]
375    CannotRemoveVerifiedCreator,
376
377    #[error("Can not wipe verified creators.")]
378    CannotWipeVerifiedCreators,
379
380    #[error("Not allowed to change seller fee basis points.")]
381    NotAllowedToChangeSellerFeeBasisPoints,
382
383    /// Edition override cannot be zero
384    #[error("Edition override cannot be zero")]
385    EditionOverrideCannotBeZero,
386
387    #[error("Invalid User")]
388    InvalidUser,
389
390    /// Revoke Collection Authority signer is incorrect
391    #[error("Revoke Collection Authority signer is incorrect")]
392    RevokeCollectionAuthoritySignerIncorrect,
393
394    // 100
395    #[error("Token close failed")]
396    TokenCloseFailed,
397
398    /// 101 - Calling v1.3 function on unsized collection
399    #[error("Can't use this function on unsized collection")]
400    UnsizedCollection,
401
402    /// 102 - Calling v1.2 function on a sized collection
403    #[error("Can't use this function on a sized collection")]
404    SizedCollection,
405
406    /// 103 - Missing collection metadata account.
407    #[error("Missing collection metadata account")]
408    MissingCollectionMetadata,
409
410    /// 104 - This NFT is not a member of the specified collection.
411    #[error("This NFT is not a member of the specified collection.")]
412    NotAMemberOfCollection,
413
414    /// 105 - This NFT is not a verified member of the specified collection.
415    #[error("This NFT is not a verified member of the specified collection.")]
416    NotVerifiedMemberOfCollection,
417
418    /// 106 - This NFT is not a collection parent NFT.
419    #[error("This NFT is not a collection parent NFT.")]
420    NotACollectionParent,
421
422    /// 107 - Could not determine a TokenStandard type.
423    #[error("Could not determine a TokenStandard type.")]
424    CouldNotDetermineTokenStandard,
425
426    /// 108 - Missing edition account for a non-fungible token type.
427    #[error("This mint account has an edition but none was provided.")]
428    MissingEditionAccount,
429
430    /// 109 - Not a Master Edition
431    #[error("This edition is not a Master Edition")]
432    NotAMasterEdition,
433
434    /// 110 - Master Edition has prints.
435    #[error("This Master Edition has existing prints")]
436    MasterEditionHasPrints,
437
438    /// 111 - Borsh Deserialization Error
439    #[error("Borsh Deserialization Error")]
440    BorshDeserializationError,
441
442    /// 112 - Cannot update a verified colleciton in this command
443    #[error("Cannot update a verified collection in this command")]
444    CannotUpdateVerifiedCollection,
445
446    /// 113 - Edition Account Doesnt Match Collection
447    #[error("Edition account doesnt match collection ")]
448    CollectionMasterEditionAccountInvalid,
449
450    /// 114 - Item is already verified.
451    #[error("Item is already verified.")]
452    AlreadyVerified,
453
454    /// 115 - Item is already unverified.
455    #[error("Item is already unverified.")]
456    AlreadyUnverified,
457
458    /// 116 - Not a Print Edition
459    #[error("This edition is not a Print Edition")]
460    NotAPrintEdition,
461
462    /// 117 - Invalid Edition Marker
463    #[error("Invalid Master Edition")]
464    InvalidMasterEdition,
465
466    /// 118 - Invalid Edition Marker
467    #[error("Invalid Print Edition")]
468    InvalidPrintEdition,
469
470    /// 119 - Invalid Edition Marker
471    #[error("Invalid Edition Marker")]
472    InvalidEditionMarker,
473
474    /// 120 - Reservation List is Deprecated
475    #[error("Reservation List is Deprecated")]
476    ReservationListDeprecated,
477
478    /// 121 - Print Edition doesn't match Master Edition
479    #[error("Print Edition does not match Master Edition")]
480    PrintEditionDoesNotMatchMasterEdition,
481
482    /// 122 - Edition Number greater than max supply
483    #[error("Edition Number greater than max supply")]
484    EditionNumberGreaterThanMaxSupply,
485
486    /// 123 - Must unverify before migrating collections.
487    #[error("Must unverify before migrating collections.")]
488    MustUnverify,
489
490    /// 124 - Invalid Escrow Account Bump Seed
491    #[error("Invalid Escrow Account Bump Seed")]
492    InvalidEscrowBumpSeed,
493
494    /// 125 - Must be Escrow Authority
495    #[error("Must Escrow Authority")]
496    MustBeEscrowAuthority,
497
498    /// 126 - Invalid System Program
499    #[error("Invalid System Program")]
500    InvalidSystemProgram,
501
502    /// 127 - Must be a Non Fungible Token
503    #[error("Must be a Non Fungible Token")]
504    MustBeNonFungible,
505
506    /// 128 - Insufficient tokens for transfer
507    #[error("Insufficient tokens for transfer")]
508    InsufficientTokens,
509
510    /// 129 - Borsh Serialization Error
511    #[error("Borsh Serialization Error")]
512    BorshSerializationError,
513
514    /// 130 - Cannot create NFT with no Freeze Authority.
515    #[error("Cannot create NFT with no Freeze Authority.")]
516    NoFreezeAuthoritySet,
517
518    /// 131
519    #[error("Invalid collection size change")]
520    InvalidCollectionSizeChange,
521
522    /// 132
523    #[error("Invalid bubblegum signer")]
524    InvalidBubblegumSigner,
525    /// 133
526    #[error("Escrow parent cannot have a delegate")]
527    EscrowParentHasDelegate,
528
529    /// 134
530    #[error("Mint needs to be signer to initialize the account")]
531    MintIsNotSigner,
532
533    /// 135
534    #[error("Invalid token standard")]
535    InvalidTokenStandard,
536
537    /// 136
538    #[error("Invalid mint account for specified token standard")]
539    InvalidMintForTokenStandard,
540
541    /// 137
542    #[error("Invalid authorization rules account")]
543    InvalidAuthorizationRules,
544
545    /// 138
546    #[error("Missing authorization rules account")]
547    MissingAuthorizationRules,
548
549    /// 139
550    #[error("Missing programmable configuration")]
551    MissingProgrammableConfig,
552
553    /// 140
554    #[error("Invalid programmable configuration")]
555    InvalidProgrammableConfig,
556
557    /// 141
558    #[error("Delegate already exists")]
559    DelegateAlreadyExists,
560
561    /// 142
562    #[error("Delegate not found")]
563    DelegateNotFound,
564
565    /// 143
566    #[error("Required account not set in instruction builder")]
567    MissingAccountInBuilder,
568
569    /// 144
570    #[error("Required argument not set in instruction builder")]
571    MissingArgumentInBuilder,
572
573    /// 145
574    #[error("Feature not supported currently")]
575    FeatureNotSupported,
576
577    /// 146
578    #[error("Invalid system wallet")]
579    InvalidSystemWallet,
580
581    /// 147
582    #[error("Only the sale delegate can transfer while its set")]
583    OnlySaleDelegateCanTransfer,
584
585    /// 148
586    #[error("Missing token account")]
587    MissingTokenAccount,
588
589    /// 149
590    #[error("Missing SPL token program")]
591    MissingSplTokenProgram,
592
593    /// 150
594    #[error("Missing authorization rules program")]
595    MissingAuthorizationRulesProgram,
596
597    /// 151
598    #[error("Invalid delegate role for transfer")]
599    InvalidDelegateRoleForTransfer,
600
601    /// 152
602    #[error("Invalid transfer authority")]
603    InvalidTransferAuthority,
604
605    /// 153
606    #[error("Instruction not supported for ProgrammableNonFungible assets")]
607    InstructionNotSupported,
608
609    /// 154
610    #[error("Public key does not match expected value")]
611    KeyMismatch,
612
613    /// 155
614    #[error("Token is locked")]
615    LockedToken,
616
617    /// 156
618    #[error("Token is unlocked")]
619    UnlockedToken,
620
621    /// 157
622    #[error("Missing delegate role")]
623    MissingDelegateRole,
624
625    /// 158
626    #[error("Invalid authority type")]
627    InvalidAuthorityType,
628
629    /// 159
630    #[error("Missing token record account")]
631    MissingTokenRecord,
632
633    /// 160
634    #[error("Mint supply must be zero for programmable assets")]
635    MintSupplyMustBeZero,
636
637    /// 161
638    #[error("Data is empty or zeroed")]
639    DataIsEmptyOrZeroed,
640
641    /// 162
642    #[error("Missing token owner")]
643    MissingTokenOwnerAccount,
644
645    /// 163
646    #[error("Master edition account has an invalid length")]
647    InvalidMasterEditionAccountLength,
648
649    /// 164
650    #[error("Incorrect token state")]
651    IncorrectTokenState,
652
653    /// 165
654    #[error("Invalid delegate role")]
655    InvalidDelegateRole,
656
657    /// 166
658    #[error("Print supply is required for non-fungibles")]
659    MissingPrintSupply,
660
661    /// 167
662    #[error("Missing master edition account")]
663    MissingMasterEditionAccount,
664
665    /// 168
666    #[error("Amount must be greater than zero")]
667    AmountMustBeGreaterThanZero,
668
669    /// 169
670    #[error("Invalid delegate args")]
671    InvalidDelegateArgs,
672
673    /// 170
674    #[error("Missing address for locked transfer")]
675    MissingLockedTransferAddress,
676
677    /// 171
678    #[error("Invalid destination address for locked transfer")]
679    InvalidLockedTransferAddress,
680
681    /// 172
682    #[error("Exceeded account realloc increase limit")]
683    DataIncrementLimitExceeded,
684
685    /// 173
686    #[error("Cannot update the rule set of a programmable asset that has a delegate")]
687    CannotUpdateAssetWithDelegate,
688
689    /// 174
690    #[error("Invalid token amount for this operation or token standard")]
691    InvalidAmount,
692
693    /// 175
694    #[error("Missing master edition mint account")]
695    MissingMasterEditionMintAccount,
696
697    /// 176
698    #[error("Missing master edition token account")]
699    MissingMasterEditionTokenAccount,
700
701    /// 177
702    #[error("Missing edition marker account")]
703    MissingEditionMarkerAccount,
704
705    /// 178
706    #[error("Cannot burn while persistent delegate is set")]
707    CannotBurnWithDelegate,
708
709    /// 179
710    #[error("Missing edition account")]
711    MissingEdition,
712
713    /// 180
714    #[error("Invalid Associated Token Account Program")]
715    InvalidAssociatedTokenAccountProgram,
716
717    /// 181
718    #[error("Invalid InstructionsSysvar")]
719    InvalidInstructionsSysvar,
720
721    /// 182
722    #[error("Invalid or Unneeded parent accounts")]
723    InvalidParentAccounts,
724
725    /// 183
726    #[error("Authority cannot apply all update args")]
727    InvalidUpdateArgs,
728
729    /// 184
730    #[error("Token account does not have enough tokens")]
731    InsufficientTokenBalance,
732
733    /// 185
734    #[error("Missing collection account")]
735    MissingCollectionMint,
736
737    /// 186
738    #[error("Missing collection master edition account")]
739    MissingCollectionMasterEdition,
740
741    /// 187
742    #[error("Invalid token record account")]
743    InvalidTokenRecord,
744
745    /// 188
746    #[error("The close authority needs to be revoked by the Utility Delegate")]
747    InvalidCloseAuthority,
748
749    /// 189
750    #[error("Invalid or removed instruction")]
751    InvalidInstruction,
752
753    /// 190
754    #[error("Missing delegate record")]
755    MissingDelegateRecord,
756}
757
758impl PrintProgramError for MetadataError {
759    fn print<E>(&self) {
760        msg!(&self.to_string());
761    }
762}
763
764impl From<MetadataError> for ProgramError {
765    fn from(e: MetadataError) -> Self {
766        ProgramError::Custom(e as u32)
767    }
768}
769
770impl<T> DecodeError<T> for MetadataError {
771    fn type_of() -> &'static str {
772        "Metadata Error"
773    }
774}