If state doesn't exist, it should raise an error
See original GitHub issueThis is confusing:
>>> import date
>>> import holidays
>>> date(2021,3,8) in holidays.CountryHoliday("DE", state="BE") # should raise an error, because state="BE" does not exist
False
>>> date(2021,3,8) in holidays.CountryHoliday("DE", prov="BE")
True
The first line after the imports should better raise an error, because for Germany one has to use prov
and not state
. At the moment this leads to subtle bugs in computing wether a day is a holiday or not.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
when other than exception, and raise application error
What I'm trying to say there is - if the error is raised, caught and handled (not re-raised to the client) by PLSQL...
Read more >How to implement error handling in SQL Server - SQLShack
This article explains how to implement SQL error handling using the SQL server try-catch statement and what can be done in general when...
Read more >Why doesn't python throw an exception when you set an ...
It will throw an error as expected. So why does this functionality exist in the first place, to be able to create a...
Read more >Best Practices for exceptions - .NET - Microsoft Learn
Learn best practices for exceptions, such as using try/catch/finally, handling common conditions without exceptions, and using predefined .
Read more >Built-in Exceptions — Python 3.11.1 documentation
In Python, all exceptions must be instances of a class that derives from ... an error condition “just like” the situation in which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Maurizio/@dr-prodigy! I agree with
subdiv
, which is why I gave you three choices! 😃#586 is fixed; I will be handling this next in my spare time.
@dr-prodigy I have a proposed solution.
According to the README, we don’t have a single country where we use both
state
andprov
. Since this is the case, I propose we simplify everything by conforming to ISO 3166-2 and call these subdivisions (argument namesubdivision
orsubd
) and make everything simple.We can maintain backwards compatibility by assigning the value of either
state
orprov
, if specified, tosubdivision
.If you agree I can do global changes this weekend and submit a PR.