Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

WebUSBDevice: Return a Failure message if read throws #28

Merged
merged 2 commits into from
Feb 11, 2019

Conversation

majorhayes
Copy link
Collaborator

Description

If read() throws an error, we should return a valid Protobuf message that can be processed down the line as if the device had returned an actual Protobuf message.

  • Use try/catch in sendRaw to catch errors and return a valid Protobuf Failure message

Other changes:

  • Add "addDefaultTransform" transform function to jest
    • rollup's commonjs module converts all commonjs module into ES6 modules with default exports
    • This allows import module from 'module' syntax to work
    • ts-jest does NOT do this, so the compiled TypeScript files are looking for .default when importing commonjs modules, resulting in an error
  • Change jest config to only look for .ts test files to avoid running any .js files in dist
  • Mock "proto.json" to also export .default

@spiceboi spiceboi merged commit 76787d4 into master Feb 11, 2019
@spiceboi spiceboi deleted the read-error-handling branch February 11, 2019 20:57
@keepkeyjon
Copy link
Contributor

LGTM, too

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants