question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onError does not catch bad URIs

See original GitHub issue

Bug description: A misspecified URI throws an exception that onError does not catch. Instead, we get a red box error: Exception thrown while executing UI block: https:// is not a file URL (when using just https:// as the uri).

To Reproduce: import React, { Component } from ‘react’; import { WebView } from ‘react-native-webview’;

class App extends Component {
  render() {
    return (
      <WebView
        source={{ uri: 'https://' }}
        onError={syntheticEvent => {
          const { nativeEvent } = syntheticEvent;
          console.warn('WebView error: ', nativeEvent);
        }}
        style={{ marginTop: 20 }}
      />
    );
  }
}

export default App;

Expected behavior: I would expect there to be some way to catch this type of exception gracefully.

Environment:

  • OS: iOS
  • OS version: simulator
  • react-native version: 0.61.4
  • react-native-webview version: 8.0.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

6reactions
SamiChabcommented, Nov 14, 2020

Hello, still searching for solutions on this… I get an error in my logs backend.js:32 Error opening URL: Error: Unable to open URL [...] without having onError fired

0reactions
nullpointer010commented, Nov 17, 2022

Same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why onError in <Image> calls every time even if Image uri is ...
i want to load static Image if URL based Image is failed on load. i've used onError method to achieve this. but onError...
Read more >
Handling operation errors - Apollo GraphQL Docs
The onError link can retry a failed operation based on the type of GraphQL error that's returned. For example, when using token-based authentication,...
Read more >
URIError: malformed URI sequence - MDN Web Docs - Mozilla
The JavaScript exception "malformed URI sequence" occurs when URI encoding or decoding wasn't successful. Message. URIError: URI malformed (V8-based) ...
Read more >
Exception Clause - Apache Camel
How Does Camel Select Which Clause Should Handle a Given Thrown Exception? Configuring RedeliveryPolicy (redeliver options); No redelivery is default for ...
Read more >
Guide to Spring Boot REST API Error Handling - Toptal
So if you are handling the REST requests directly on Jersey it should not handle the exceptions. Can't you use @RequestMapping? Bruno. I'm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found