mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							40 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
	
	
							40 lines
						
					
					
						
							1.0 KiB
						
					
					
				| # frozen_string_literal: true
 | |
| 
 | |
| class ErrorsController < ActionController::Base
 | |
|   ENTERPRISE_FEATURE_MESSAGE =
 | |
|     'This feature is available in Pro Edition: https://www.docuseal.co/pricing'
 | |
| 
 | |
|   ENTERPRISE_PATHS = [
 | |
|     '/templates/html',
 | |
|     '/api/templates/html',
 | |
|     '/templates/pdf',
 | |
|     '/api/templates/pdf',
 | |
|     '/templates/doc',
 | |
|     '/api/templates/doc',
 | |
|     '/templates/docx',
 | |
|     '/api/templates/docx'
 | |
|   ].freeze
 | |
| 
 | |
|   def show
 | |
|     if request.original_fullpath.in?(ENTERPRISE_PATHS) && error_status_code == 404
 | |
|       return render json: { status: 404, message: ENTERPRISE_FEATURE_MESSAGE }, status: :not_found
 | |
|     end
 | |
| 
 | |
|     respond_to do |f|
 | |
|       f.json do
 | |
|         render json: { status: error_status_code }, status: error_status_code
 | |
|       end
 | |
| 
 | |
|       f.html { render error_status_code.to_s, status: error_status_code }
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def error_status_code
 | |
|     @error_status_code ||=
 | |
|       ActionDispatch::ExceptionWrapper.new(request.env,
 | |
|                                            request.env['action_dispatch.exception']).status_code
 | |
|   end
 | |
| end
 |