001package gudusoft.gsqlparser.lineage.v2;
002
003/**
004 * A rejection with an SQL-LR diagnostic code ({@code registry/core-registry.json}, group
005 * {@code diagnosticCodes}), such as {@code SCHEMA_INVALID_JSON} or {@code ID_INVALID_INPUT}.
006 *
007 * <p>The code is the contract; the detail is for people and may change.</p>
008 *
009 * @since 4.2.17
010 */
011public class SqllrException extends RuntimeException {
012
013    private static final long serialVersionUID = 1L;
014
015    private final String code;
016    private final String detail;
017
018    public SqllrException(String code, String detail) {
019        super(code + (detail == null || detail.isEmpty() ? "" : ": " + detail));
020        this.code = code;
021        this.detail = detail == null ? "" : detail;
022    }
023
024    /** The registered diagnostic code. */
025    public String getCode() {
026        return code;
027    }
028
029    /** A human-readable explanation; not part of the contract. */
030    public String getDetail() {
031        return detail;
032    }
033}