Last active
January 26, 2022 12:17
-
-
Save nk23x/f6bba6464d0090484ef4c3c469ab2af1 to your computer and use it in GitHub Desktop.
make java exception messages readable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ## | |
| ## patterns copied from | |
| ## https://raw.githubusercontent.com/staxmanade/ExceptionMessageBeautifier/master/src/ExceptionMessageBeautifier.js | |
| ## see also: | |
| ## https://superuser.com/a/747905 | |
| ## | |
| PERL_CMD="perl -pe 's/ at/\\r\\n at/g; s/ ---> /\\r\\n ---> /g; s/\) at /\\r\\n at /g; s/ --- End of inner exception stack trace ---/\\r\\n --- End of inner exception stack trace ---/g;'" | |
| FILE_IN="$1" | |
| if [ -p /dev/stdin ]; then | |
| while IFS= read INPUT; do | |
| cat ${INPUT} | ${PERL_CMD} | |
| done | |
| else | |
| if [ -f $FILE_IN ]; then | |
| cat ${FILE_IN} | ${PERL_CMD} | |
| else | |
| echo -e "\n no input submitted.\n syntax:\n $0 {FILE}\n cat {FILE} | $0\n\n" | |
| fi | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment