Skip to content

Commit

Permalink
Throw instead of assert
Browse files Browse the repository at this point in the history
The assertion crashed code-d and gave no information on what was wrong.
  • Loading branch information
MrcSnm authored Oct 22, 2024
1 parent a1d23d0 commit 5791dba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/dub/dependency.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ public struct PackageName
if (auto idx = fn.indexOf(':'))
this.separator = idx > 0 ? idx : fn.length;
else // We were given `:foo`
assert(0, "Argument to PackageName constructor needs to be " ~
"a fully qualified string");
{
//Use throw so libraries can get that information
throw new Exception("Argument to PackageName constructor needs to have " ~
"a fully qualified name (Don't use ':' at the start). Received as package name '"~fn~"'');
}
}
/// Private constructor to have nothrow / @nogc
Expand Down

0 comments on commit 5791dba

Please sign in to comment.