better error handling for kitty