5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:51:41 +00:00

fix: no producir type error

This commit is contained in:
f 2023-03-20 15:33:28 -03:00
parent 5ec698366a
commit d25937f536

View file

@ -16,7 +16,7 @@ class GitlabNotifierJob < ApplicationJob
# @param [Hash] opciones de ExceptionNotifier # @param [Hash] opciones de ExceptionNotifier
def perform(exception, **options) def perform(exception, **options)
@exception = exception @exception = exception
@options = options @options = fix_options options
@issue_data = { count: 1 } @issue_data = { count: 1 }
# Necesitamos saber si el issue ya existía # Necesitamos saber si el issue ya existía
@cached = false @cached = false
@ -88,10 +88,9 @@ class GitlabNotifierJob < ApplicationJob
].join('/') ].join('/')
end end
# @return [Array]
def errors def errors
return '' unless javascript? options.dig(:data, :params, 'errors') || []
options.dig(:data, :params, 'errors')
end end
# Define si es una excepción de javascript o local # Define si es una excepción de javascript o local
@ -288,4 +287,15 @@ class GitlabNotifierJob < ApplicationJob
def url def url
@url ||= request&.url || options.dig(:data, :params, 'context', 'url') @url ||= request&.url || options.dig(:data, :params, 'context', 'url')
end end
# Define llaves necesarias
#
# @param :options [Hash]
# @return [Hash]
def fix_options(options)
options[:data] ||= {}
options[:data][:params] ||= {}
options
end
end end