| 53 | } |
| 54 | |
| 55 | public static PigException getPigException(Throwable top) { |
| 56 | Throwable current = top; |
| 57 | Throwable pigException = top; |
| 58 | |
| 59 | if (current instanceof PigException && |
| 60 | (((PigException)current).getErrorCode() != 0) && |
| 61 | ((PigException) current).getMarkedAsShowToUser()) { |
| 62 | return (PigException) current; |
| 63 | } |
| 64 | while (current != null && current.getCause() != null){ |
| 65 | current = current.getCause(); |
| 66 | if((current instanceof PigException) && |
| 67 | (((PigException)current).getErrorCode() != 0)) { |
| 68 | pigException = current; |
| 69 | if (((PigException)pigException).getMarkedAsShowToUser()) { |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | return (pigException instanceof PigException? (PigException)pigException |
| 75 | : null); |
| 76 | } |
| 77 | |
| 78 | public static void writeLog(Throwable t, String logFileName, Log log, boolean verbose, String headerMessage) { |
| 79 | writeLog(t, logFileName, log, verbose, headerMessage, true, true); |