Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4cd4740d
Commit
4cd4740d
authored
Jul 13, 2018
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rails5 fix NoMethodError: undefined method 'message' for nil:NilClass
parent
2190828c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
ee/changelogs/unreleased/rails5-fix-6605.yml
ee/changelogs/unreleased/rails5-fix-6605.yml
+5
-0
ee/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
.../lib/gitlab/database/load_balancing/load_balancer_spec.rb
+39
-8
No files found.
ee/changelogs/unreleased/rails5-fix-6605.yml
0 → 100644
View file @
4cd4740d
---
title
:
'
Rails5
fix
NoMethodError:
undefined
method
'
'
message'
'
for
nil:NilClass'
merge_request
:
6507
author
:
Jasper Maes
type
:
fixed
ee/spec/lib/gitlab/database/load_balancing/load_balancer_spec.rb
View file @
4cd4740d
...
...
@@ -12,6 +12,41 @@ describe Gitlab::Database::LoadBalancing::LoadBalancer do
RequestStore
.
delete
(
described_class
::
CACHE_KEY
)
end
def
raise_and_wrap
(
wrapper
,
original
)
raise
original
rescue
original
.
class
raise
wrapper
.
new
(
'boop'
)
end
def
wrapped_exception
(
wrapper
,
original
)
if
Gitlab
.
rails5?
begin
raise_and_wrap
(
wrapper
,
original
.
new
)
rescue
wrapper
=>
error
error
end
else
wrapper
.
new
(
'boop'
,
original
.
new
)
end
end
def
twice_wrapped_exception
(
top
,
middle
,
original
)
if
Gitlab
.
rails5?
begin
begin
raise_and_wrap
(
middle
,
original
.
new
)
rescue
middle
=>
middle_error
raise_and_wrap
(
top
,
middle_error
)
end
rescue
top
=>
top_error
top_error
end
else
middle_error
=
middle
.
new
(
'boop'
,
original
.
new
)
top
.
new
(
'boop'
,
middle_error
)
end
end
describe
'#read'
do
let
(
:conflict_error
)
{
Class
.
new
(
RuntimeError
)
}
...
...
@@ -227,23 +262,19 @@ describe Gitlab::Database::LoadBalancing::LoadBalancer do
end
it
'returns true for a wrapped connection error'
do
original
=
NotImplementedError
.
new
wrapped
=
ActiveRecord
::
StatementInvalid
.
new
(
'boop'
,
original
)
wrapped
=
wrapped_exception
(
ActiveRecord
::
StatementInvalid
,
NotImplementedError
)
expect
(
lb
.
connection_error?
(
wrapped
)).
to
eq
(
true
)
end
it
'returns true for a wrapped connection error from a view'
do
original
=
NotImplementedError
.
new
wrapped
=
ActionView
::
Template
::
Error
.
new
(
'boop'
,
original
)
wrapped
=
wrapped_exception
(
ActionView
::
Template
::
Error
,
NotImplementedError
)
expect
(
lb
.
connection_error?
(
wrapped
)).
to
eq
(
true
)
end
it
'returns true for deeply wrapped/nested errors'
do
original
=
NotImplementedError
.
new
middle
=
ActiveRecord
::
StatementInvalid
.
new
(
'boop'
,
original
)
top
=
ActionView
::
Template
::
Error
.
new
(
'boop'
,
middle
)
top
=
twice_wrapped_exception
(
ActionView
::
Template
::
Error
,
ActiveRecord
::
StatementInvalid
,
NotImplementedError
)
expect
(
lb
.
connection_error?
(
top
)).
to
eq
(
true
)
end
...
...
@@ -276,7 +307,7 @@ describe Gitlab::Database::LoadBalancing::LoadBalancer do
end
it
'returns true for a wrapped error'
do
wrapped
=
ActionView
::
Template
::
Error
.
new
(
'boop'
,
conflict_error
.
new
)
wrapped
=
wrapped_exception
(
ActionView
::
Template
::
Error
,
conflict_error
)
expect
(
lb
.
serialization_failure?
(
wrapped
)).
to
eq
(
true
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment