20
20
*/
21
21
class Exception extends BaseException
22
22
{
23
+
24
+ /**
25
+ * @const string ERROR_FIELDSET_NOT_FOUND Error template
26
+ */
27
+ const ERROR_FIELDSET_NOT_FOUND = 'Could not find fieldset %s. ' ;
28
+
23
29
/**
24
- * @const string ERROR_NO_MODEL Error template
30
+ * @const string ERROR_FIELDSET_EXISTS
31
+ */
32
+ const ERROR_FIELDSET_EXISTS = 'Unable to restore %s, fieldset already exists. ' ;
33
+
34
+ /**
35
+ * @const string ERROR_FIELDSET_ARCHIVE_EXISTS
36
+ */
37
+ const ERROR_FIELDSET_ARCHIVE_EXISTS = 'Unable to archive %s, an archive of the fieldset already exists. ' ;
38
+
39
+ /**
40
+ * @const string ERROR_NO_SCHEMA Error template
25
41
*/
26
42
const ERROR_NO_SCHEMA = 'Schema is not loaded ' ;
27
43
28
44
/**
29
- * @const string ERROR_CONFIG_NOT_FOUND Error template
45
+ * @const string ERROR_SCHEMA_NOT_FOUND Error template
30
46
*/
31
47
const ERROR_SCHEMA_NOT_FOUND = 'Could not find schema %s. ' ;
32
48
@@ -45,6 +61,46 @@ class Exception extends BaseException
45
61
*/
46
62
const ERROR_SCHEMA_NO_RELATION = '%s has no relation to %s ' ;
47
63
64
+ /**
65
+ * Create a new exception for missing fieldset
66
+ *
67
+ * @param *string $name
68
+ *
69
+ * @return Exception
70
+ */
71
+ public static function forFieldsetNotFound ($ name ): Exception
72
+ {
73
+ $ message = sprintf (static ::ERROR_FIELDSET_NOT_FOUND , $ name );
74
+ return new static ($ message );
75
+ }
76
+
77
+ /**
78
+ * Create a new exception if fieldset already exists
79
+ *
80
+ * @param *string $name
81
+ *
82
+ * @return Exception
83
+ */
84
+ public static function forFieldsetAlreadyExists (string $ name )
85
+ {
86
+ $ message = sprintf (static ::ERROR_FIELDSET_EXISTS , $ name );
87
+ return new static ($ message );
88
+ }
89
+
90
+ /**
91
+ * Create a new exception if an archived of the
92
+ * given fieldset already exists.
93
+ *
94
+ * @param *string $name
95
+ *
96
+ * @return Exception
97
+ */
98
+ public static function forFieldsetArchiveExists (string $ name )
99
+ {
100
+ $ message = sprintf (static ::ERROR_FIELDSET_ARCHIVE_EXISTS , $ name );
101
+ return new static ($ message );
102
+ }
103
+
48
104
/**
49
105
* Create a new exception for missing Schema
50
106
*
@@ -66,7 +122,7 @@ public static function forNoSchema(): Exception
66
122
}
67
123
68
124
/**
69
- * Create a new exception for missing config
125
+ * Create a new exception for missing Schema
70
126
*
71
127
* @param *string $name
72
128
*
0 commit comments