Rescue Fluent::ConfigError

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-06-15 14:20:05 +09:00
parent fe32983c0f
commit c55038ed17
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1
2 changed files with 8 additions and 1 deletions

View File

@ -23,6 +23,8 @@ class ApiController < ApplicationController
preview = RegexpPreview.processor(params[:parse_type]).new(params[:file], params[:parse_type], plugin_config)
render json: preview.matches
rescue Fluent::ConfigError => ex
render json: { error: "#{ex.class}: #{ex.message}" }
end
def grok_to_regexp

View File

@ -139,7 +139,12 @@ $(document).ready(() => {
}
}).then(
(result) => {
this.updateHighlightedLines(result.matches)
if (result.matches) {
this.updateHighlightedLines(result.matches)
} else {
console.error(result.error)
this.previewError = result.error
}
},
(error) => {
this.highlightedLines = null