Smart Contract
MelodyError
A.32a6af84f2f54476.MelodyError
1pub contract MelodyError {
2
3 pub enum ErrorCode: UInt8 {
4 pub case NO_ERROR
5 pub case PAUSED
6 pub case NOT_EXIST
7 pub case INVALID_PARAMETERS
8 pub case NEGATIVE_VALUE_NOT_ALLOWED
9 pub case ALREADY_EXIST
10 pub case CAN_NOT_BE_ZERO
11 pub case SAME_BOOL_STATE
12 pub case WRONG_LIFE_CYCLE_STATE
13 pub case ACCESS_DENIED
14 pub case PAYMENT_NOT_REVOKABLE
15 pub case NOT_TRANSFERABLE
16 pub case TYPE_MISMATCH
17
18 }
19
20 pub fun errorEncode(msg: String, err: ErrorCode): String {
21 return "[MelodyErrorMsg:".concat(msg).concat("]").concat("[MelodyErrorCode:").concat(err.rawValue.toString()).concat("]")
22 }
23
24 init() {
25 }
26}