-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 handle OOM errors and fix default location
Signed-off-by: Shawn Hurley <[email protected]>
- Loading branch information
1 parent
dc66315
commit 4cb9f3c
Showing
3 changed files
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
package jsonrpc2 | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
var errFileClosed = "file already closed" | ||
var errBrokenPipe = "broken pipe" | ||
var oomError = "java.lang.OutOfMemoryError" | ||
|
||
func IsRPCClosed(err error) bool { | ||
var errMsg = err.Error() | ||
return strings.HasSuffix(errMsg, errFileClosed) || strings.HasSuffix(errMsg, errBrokenPipe) | ||
} | ||
|
||
func IsOOMError(err *Error) bool { | ||
return strings.Contains(fmt.Sprintf("%s", err.Data), oomError) | ||
} |