Coder Social home page Coder Social logo

Uri.origin should never throw about sdk HOT 2 OPEN

giregk avatar giregk commented on August 14, 2024
Uri.origin should never throw

from sdk.

Comments (2)

github-actions avatar github-actions commented on August 14, 2024

area-core-library, type-enhancement

The Uri.origin method throws an exception when the scheme or host properties are empty or null. This behavior is unexpected and can lead to bugs, especially when dealing with unknown URIs. The user proposes that Uri.origin should always return a value, even if the scheme or host is missing, to avoid unexpected exceptions.

from sdk.

lrhn avatar lrhn commented on August 14, 2024

It's not technically a breaking change to make something not throw an error, but if the current origin behavior is being used as a way to check if two different URIs have the same origin, then returning an empty string instead of an error may cause false positives.

The Dart Uri.origin matches neither the HTML behavior nor the WhatWG URL behavior, so there is no real specification that it's failing to follow. It's not even trying.

I think returning the string "null" would be a reasonable (and semi-compliant) behavior. Maybe we should do that.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.