1 /*
2 * CSVeed (https://github.com/42BV/CSVeed)
3 *
4 * Copyright 2013-2023 CSVeed.
5 *
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of The Apache Software License,
8 * Version 2.0 which accompanies this distribution, and is available at
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 */
11 package org.csveed.report;
12
13 import java.util.List;
14
15 /**
16 * Report on an error, always including at the very least an error message. If the error can be pinpointed to a line or
17 * cell, this information is included as well.
18 */
19 public interface CsvError {
20
21 /**
22 * Returns all lines, first the message, then the content and focus line, if available. These lines are usable to
23 * print with a monospaced font, since the focus line will show in the line above where the error occurred. If lines
24 * are needed for the browser, use {@link #getRowParts()}.
25 *
26 * @return all lines, in printable format. Will always contain at least one line.
27 */
28 List<String> getPrintableLines();
29
30 /**
31 * Gets the content line where the error occurred, if available. The line is split into RowPart entries. Every
32 * RowPart knows about itself when it must be highlighted. This method is useful for reporting on the error in
33 * another format, for example HTML or PDF, since you can control the highlighting.
34 *
35 * @return the content line split into RowPart entries. Will be an empty list if not available.
36 */
37 List<RowPart> getRowParts();
38
39 /**
40 * Returns the line number where the error occurred, zero-based. Will be -1 if not applicable.
41 *
42 * @return line number where the error occurred
43 */
44 int getLineNumber();
45
46 /**
47 * Returns the original error message.
48 *
49 * @return error message
50 */
51 String getMessage();
52
53 }