Skip to content

Commit 422fbc5

Browse files
committed
Add WhitehallError base class
As introduced in draft PR #11431. Sometimes we just want a generic Whitehall error, or a way of catching multiple Whitehall errors, without accidentally swallowing unexpected errors like NoMethodError etc.
1 parent 22dcfd9 commit 422fbc5

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

app/models/whitehall_error.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Base class for Whitehall-specific domain errors.
2+
#
3+
# We rescue WhitehallError in places where we want to handle
4+
# expected business/application failures gracefully, without also
5+
# swallowing unexpected framework or programming errors.
6+
#
7+
# Avoid rescuing StandardError directly unless we genuinely intend
8+
# to catch any application exception, including Rails, ActiveRecord,
9+
# or Ruby runtime errors.
10+
#
11+
# Any error inheriting from WhitehallError is considered part of
12+
# Whitehall's intentional public error surface.
13+
class WhitehallError < StandardError
14+
end

0 commit comments

Comments
 (0)