13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/coupler/extensions/exceptions.rb', line 13
def self.registered(app)
app.error ProjectNotFound do
flash[:notice] = "The project you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect(Models::Project.count > 0 ? '/projects' : '/')
end
app.error ResourceNotFound do
flash[:notice] = "The resource you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}/resources"
end
app.error TransformationNotFound do
flash[:notice] = "The transformation you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}/resources/#{@resource.id}/transformations"
end
app.error ScenarioNotFound do
flash[:notice] = "The scenario you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}/scenarios"
end
app.error MatcherNotFound do
flash[:notice] = "The matcher you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}/scenarios/#{@scenario.id}"
end
app.error ResultNotFound do
flash[:notice] = "The result you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}/scenarios/#{@scenario.id}/results"
end
app.error ImportNotFound do
flash[:notice] = "The import you were looking for doesn't exist."
flash[:notice_class] = 'error'
redirect "/projects/#{@project.id}"
end
end
|