-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLJErrorDTO.java
More file actions
34 lines (27 loc) · 1.14 KB
/
Copy pathLJErrorDTO.java
File metadata and controls
34 lines (27 loc) · 1.14 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
package dtos.errors;
import dtos.diagnostics.LJDiagnosticDTO;
import dtos.diagnostics.SourcePositionDTO;
import dtos.diagnostics.TranslationTableDTO;
import liquidjava.diagnostics.errors.LJError;
/**
* DTO for serializing LJError instances to JSON
*/
public class LJErrorDTO extends LJDiagnosticDTO {
public final TranslationTableDTO translationTable;
public LJErrorDTO(String type, LJError error) {
super("error", type, error);
this.translationTable = TranslationTableDTO.from(error.getTranslationTable());
}
protected LJErrorDTO(String category, String type, LJError error) {
super(category, type, error);
this.translationTable = TranslationTableDTO.from(error.getTranslationTable());
}
public LJErrorDTO(String category, String type, String title, String message, String details, String file,
SourcePositionDTO position, TranslationTableDTO translationTable) {
super(category, type, title, message, details, file, position);
this.translationTable = translationTable;
}
public static LJErrorDTO from(LJError error) {
return new LJErrorDTO(null, error);
}
}