Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit edf2acb

Browse files
committed
Enhance the error message in keyboard
1 parent 1f096a9 commit edf2acb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common/keyboard.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (k *Keyboard) up(key string) error {
124124
func (k *Keyboard) insertText(text string) error {
125125
action := input.InsertText(text)
126126
if err := action.Do(cdp.WithExecutor(k.ctx, k.session)); err != nil {
127-
return fmt.Errorf("unable to send character: %w", err)
127+
return fmt.Errorf("cannot send character: %w", err)
128128
}
129129
return nil
130130
}
@@ -216,7 +216,7 @@ func (k *Keyboard) press(key string, opts *KeyboardOptions) error {
216216
}
217217
}
218218
if err := k.down(key); err != nil {
219-
return err
219+
return fmt.Errorf("cannot down: %w", err)
220220
}
221221
return k.up(key)
222222
}
@@ -235,12 +235,12 @@ func (k *Keyboard) typ(text string, opts *KeyboardOptions) error {
235235
keyInput := keyboardlayout.KeyInput(c)
236236
if _, ok := layout.ValidKeys[keyInput]; ok {
237237
if err := k.press(string(c), opts); err != nil {
238-
return err
238+
return fmt.Errorf("cannot press: %w", err)
239239
}
240240
continue
241241
}
242242
if err := k.insertText(string(c)); err != nil {
243-
return err
243+
return fmt.Errorf("cannot insert text: %w", err)
244244
}
245245
}
246246
return nil

0 commit comments

Comments
 (0)