Skip to content

Commit f0856d5

Browse files
committed
1069: Add error_type to duplication response
1 parent 6478ceb commit f0856d5

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

app/controllers/api/schools_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def create
2222
@school = result[:school]
2323
render :show, formats: [:json], status: :created
2424
else
25-
render json: { error: result[:error] }, status: :unprocessable_entity
25+
render json: {
26+
error: result[:error],
27+
error_type: result[:error_type] || :unknown_error
28+
}, status: :unprocessable_entity
2629
end
2730
end
2831

lib/concepts/school/operations/create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def call(school_params:, creator_id:, token:)
1616
response
1717
rescue School::DuplicateSchoolError => e
1818
response[:error] = e.message
19+
response[:error_type] = :duplication_error
1920
response
2021
rescue StandardError => e
2122
Sentry.capture_exception(e)

0 commit comments

Comments
 (0)