-
-
Save takeru/366814 to your computer and use it in GitHub Desktop.
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
| module AppEngine | |
| module Datastore | |
| class << self | |
| alias convert_exceptions_ORIG convert_exceptions | |
| def convert_exceptions | |
| begin | |
| convert_exceptions_ORIG do | |
| yield | |
| end | |
| rescue com.google.apphosting.api.ApiProxy::ApplicationException => ex | |
| case ex.message | |
| when /ApplicationError: 2: too much contention on these datastore entities. please try again./ | |
| raise TransactionFailed, ex.message | |
| when /ApplicationError: 5: Unknown/ | |
| raise Timeout, ex.message | |
| when /ApplicationError: 90000: Deadlined while in scheduler/ | |
| raise Timeout, ex.message | |
| else | |
| raise ex | |
| end | |
| rescue com.google.apphosting.api.ApiProxy::ApiDeadlineExceededException => ex | |
| raise Timeout, ex.message | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment