forked from Vault-Web/cloud-page
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceNotFoundException.java
More file actions
36 lines (33 loc) · 1.06 KB
/
Copy pathResourceNotFoundException.java
File metadata and controls
36 lines (33 loc) · 1.06 KB
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
36
package cloudpage.exceptions;
public class ResourceNotFoundException extends RuntimeException {
String resourceName;
String fieldName;
String field;
Long fieldId;
/**
* constructor to throw exception when ID is provided
*
* @param resourceName - name of resource
* @param fieldName - field name
* @param field - value of field
*/
public ResourceNotFoundException(String resourceName, String fieldName, String field) {
super(String.format("%s not found with %s : %s", resourceName, fieldName, field));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.field = field;
}
/**
* constructor to throw exception when ID is provided
*
* @param resourceName - name of resource
* @param field - field name
* @param fieldId - id of field
*/
public ResourceNotFoundException(String resourceName, String field, Long fieldId) {
super(String.format("%s not found with %s : %d", resourceName, field, fieldId));
this.fieldId = fieldId;
this.resourceName = resourceName;
this.field = field;
}
}