Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
Could return undefined if no files where present.
  • Loading branch information
dgud committed Aug 15, 2024
1 parent aafb71f commit f2599b4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/public_key/src/pubkey_os_cacerts.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@ get() ->
%% (Re)Load default os cacerts and cache result.
-spec load() -> ok | {error, Reason::term()}.
load() ->
DefError = {error, no_cacerts_found},
case os:type() of
{unix, linux} ->
load(linux_paths(), undefined);
load(linux_paths(), DefError);
{unix, openbsd} ->
load(bsd_paths(), undefined);
load(bsd_paths(), DefError);
{unix, freebsd} ->
load(bsd_paths(), undefined);
load(bsd_paths(), DefError);
{unix, dragonfly} ->
load(bsd_paths(), undefined);
load(bsd_paths(), DefError);
{unix, netbsd} ->
load(bsd_paths(), undefined);
load(bsd_paths(), DefError);
{unix, sunos} ->
load(sunos_paths(), undefined);
load(sunos_paths(), DefError);
{win32, _} ->
load_win32();
{unix, darwin} ->
Expand Down

0 comments on commit f2599b4

Please sign in to comment.