Skip to content

Improved errors

Choose a tag to compare

@pixelmatrix pixelmatrix released this 03 Jul 19:14

New Features

  • You can now include signUpOptions as an option when creating a Bitski connect button:
import { LOGIN_HINT_SIGNUP, ConnectButtonSize, Bitski } from 'bitski';

// Default to sign up flow when logging in
const opts = {
  size: ConnectButtonSize.Large,
  signInOptions: {
    login_hint: LOGIN_HINT_SIGNUP,
  },
};
const button = bitski.getConnectButton(opts);
  • There are now custom error types for most errors thrown by the Bitski SDK. See the src/errors folder within each sub-package for more details.
// Handling user cancelled error
import { AuthenticationErrorCode } from 'bitski';

try {
  await bitski.signIn();
} catch (error) {
  if (error.code === AuthenticationErrorCode.UserCancelled) {
    // handle cancellation
  } else {
    // handle error
  }
}