summaryrefslogtreecommitdiff
path: root/source/storage/VaultError.mc
blob: 7320ce46d569fa8b85400de87161168490c8d8bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Author:  cirakg & claude ai
// Summary: The one exception type the storage layer throws, with a code the UI turns into a message.

import Toybox.Lang;

class VaultError extends Lang.Exception {

    // The session is locked and the operation needs the master key.
    static const LOCKED = 1;
    // A record or the PIN wrap failed to decode or verify.
    static const DAMAGED = 2;
    // Application.Storage refused a write (store full).
    static const FULL = 3;
    // The entry cap is reached, or one record would be too big.
    static const LIMIT = 4;
    // No entry with that ID.
    static const NOT_FOUND = 5;
    // The data was written by a newer app version; nothing may be changed.
    static const NEWER_SCHEMA = 6;
    // The entry failed validation (see Entry.validate()).
    static const INVALID = 7;
    // A wrong-PIN delay is running; try again later.
    static const LOCKED_OUT = 8;
    // The operation needs a PIN and none is set, or a PIN is already set.
    static const NO_PIN = 9;
    static const PIN_EXISTS = 10;

    var code as Number;

    function initialize(errorCode as Number, message as String) {
        Exception.initialize();
        code = errorCode;
        mMessage = message;
    }
}