Okta Self-Hosted Widget - Render a Custom Error

Is it possible to render a custom error in the widget? If so, how can I do that?

For example, in the code snippet below, if I insert logic before handleLoginRedirect, and I want to conditionally render an error message in the widget, how can I accomplish that?

  el: '#sign-in-widget',
}).then((tokens: Tokens) => {
    Custom logic with error rendering
}).catch((err: any) => {
  throw err;