1 module libpb.exceptions; 2 3 public abstract class PBException : Exception 4 { 5 this(string message = "") 6 { 7 super("PBException: "~message); 8 } 9 } 10 11 public final class RecordNotFoundException : PBException 12 { 13 public const string offendingTable; 14 public const string offendingId; 15 this(string table, string id) 16 { 17 this.offendingTable = table; 18 this.offendingId = id; 19 20 super("Could not find record '"~id~"' in table '"~offendingTable~"'"); 21 } 22 } 23 24 public final class NotAuthorized : PBException 25 { 26 public const string offendingTable; 27 public const string offendingId; 28 this(string table, string id) 29 { 30 this.offendingTable = table; 31 this.offendingId = id; 32 } 33 } 34 35 public final class ValidationRequired : PBException 36 { 37 public const string offendingTable; 38 public const string offendingId; 39 this(string table, string id) 40 { 41 this.offendingTable = table; 42 this.offendingId = id; 43 } 44 } 45 46 47 /** 48 * NetworkException 49 * 50 * Thrown on an unhandled curl error 51 */ 52 public final class NetworkException : PBException 53 { 54 this() 55 { 56 57 } 58 } 59 60 public final class PocketBaseParsingException : PBException 61 { 62 63 }