diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 24ea265..11445a0 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -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 diff --git a/app/javascript/packs/in_tail_parse.js b/app/javascript/packs/in_tail_parse.js index 60124bd..9cf205a 100644 --- a/app/javascript/packs/in_tail_parse.js +++ b/app/javascript/packs/in_tail_parse.js @@ -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