gracefully handle inst-fs service errors
closes FOO-1327 flag=none TEST PLAN: 1) make inst-fs fail with 502 2) upload something to canvas for SIS import 3) user gets a 502 Change-Id: Id9c851b3246cd7b413f8a4428243b09d98477066 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255072 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Charley Kline <ckline@instructure.com> Product-Review: Charley Kline <ckline@instructure.com> QA-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
parent
59628c7a90
commit
7d190b3def
|
@ -364,6 +364,9 @@ class SisImportsApiController < ApplicationController
|
|||
include Api::V1::SisImport
|
||||
include Api::V1::Progress
|
||||
|
||||
rescue_from InstFS::ServiceError, with: :rescue_expected_error_type
|
||||
rescue_from InstFS::BadRequestError, with: :rescue_expected_error_type
|
||||
|
||||
def check_account
|
||||
return render json: {errors: ["SIS imports can only be executed on root accounts"]}, status: :bad_request unless @account.root_account?
|
||||
return render json: {errors: ["SIS imports are not enabled for this account"]}, status: :forbidden unless @account.allow_sis_import
|
||||
|
|
|
@ -520,8 +520,16 @@ module InstFS
|
|||
end
|
||||
|
||||
class DirectUploadError < StandardError; end
|
||||
class ServiceError < DirectUploadError; end
|
||||
class BadRequestError < DirectUploadError; end
|
||||
class ServiceError < DirectUploadError
|
||||
def response_status
|
||||
502
|
||||
end
|
||||
end
|
||||
class BadRequestError < DirectUploadError
|
||||
def response_status
|
||||
400
|
||||
end
|
||||
end
|
||||
class ExportReferenceError < StandardError; end
|
||||
class DuplicationError < StandardError; end
|
||||
class DeletionError < StandardError; end
|
||||
|
|
Loading…
Reference in New Issue