Log X errors
This commit is contained in:
parent
02861a63d4
commit
036ca1f989
17
features/manager/x_errors.feature
Normal file
17
features/manager/x_errors.feature
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Feature: X errors logging
|
||||||
|
|
||||||
|
Scenario: logs error details
|
||||||
|
Given a file named layout.rb with:
|
||||||
|
"""
|
||||||
|
class Layout
|
||||||
|
def register _; end
|
||||||
|
|
||||||
|
# Focusing a client before mapping will force an error
|
||||||
|
def << client
|
||||||
|
client.focus
|
||||||
|
end
|
||||||
|
end
|
||||||
|
"""
|
||||||
|
And uhwm is running with options -v -r./layout -l Layout
|
||||||
|
When a window requests to be mapped
|
||||||
|
Then the output must match /x.*error.+x_setinputfocus.+/i
|
@ -69,7 +69,7 @@ module Uh
|
|||||||
private
|
private
|
||||||
|
|
||||||
def handle_error *args
|
def handle_error *args
|
||||||
@dispatcher.emit :error, args: args
|
@events.emit :xerror, args: args
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_key_press event
|
def handle_key_press event
|
||||||
|
@ -101,6 +101,7 @@ module Uh
|
|||||||
end
|
end
|
||||||
@events.on(:disconnected) { log "Disconnected from X server" }
|
@events.on(:disconnected) { log "Disconnected from X server" }
|
||||||
@events.on(:xevent) { |event| XEventLogger.new(env).log_event event }
|
@events.on(:xevent) { |event| XEventLogger.new(env).log_event event }
|
||||||
|
@events.on(:xerror) { |*error| XEventLogger.new(env).log_xerror *error }
|
||||||
end
|
end
|
||||||
|
|
||||||
def register_layout_hooks
|
def register_layout_hooks
|
||||||
@ -143,6 +144,10 @@ module Uh
|
|||||||
complement
|
complement
|
||||||
].compact.join ' '
|
].compact.join ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_xerror req, resource_id, msg
|
||||||
|
log_error "XERROR: #{resource_id} #{req} #{msg}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user