diff --git a/src/routes/error.rb b/src/routes/error.rb new file mode 100644 index 0000000..f48d514 --- /dev/null +++ b/src/routes/error.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# error handling routes +class Destructo < Sinatra::Base + + error 404 do + erb :'error/404', locals: { + title: 'Page not found' + } + end + +end diff --git a/src/routes/init.rb b/src/routes/init.rb index ec70f92..bb513cf 100644 --- a/src/routes/init.rb +++ b/src/routes/init.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require_relative 'error' require_relative 'index' require_relative 'message' diff --git a/views/error/404.erb b/views/error/404.erb new file mode 100644 index 0000000..83d3490 --- /dev/null +++ b/views/error/404.erb @@ -0,0 +1,5 @@ +

This page does not exist.

+ +

If you're looking for a message, it's possible that it has already been viewed and subsequently deleted.

+ +

If you would like to send a new message, head back home to get started.

\ No newline at end of file diff --git a/views/index/home.erb b/views/index/home.erb index ed6c601..7e6fe63 100644 --- a/views/index/home.erb +++ b/views/index/home.erb @@ -1,5 +1,7 @@

This is the home page.

+ +

Click here to send a new message.