Skip to content

Commit 207a85f

Browse files
Update Database.cs
1 parent a89f3fe commit 207a85f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

FileSystem/Structures/Database.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,23 @@ public Result Set(string key, Value value, bool save = true)
8989
return true;
9090
}
9191

92-
public TryGet<Value> Get(string key)
92+
public TryGet<DatabaseValue> HasKey(string key)
9393
{
9494
if (!_db.TryGetValue(key, out var val))
9595
{
9696
return $"There is no key called '{key}' in the '{_name}' database.";
9797
}
9898

99+
return val;
100+
}
101+
102+
public TryGet<Value> Get(string key)
103+
{
104+
if (HasKey(key).HasErrored(out var err, out var val))
105+
{
106+
return err;
107+
}
108+
99109
if (val.Value is null)
100110
{
101111
return $"Value of key '{key}' is not set.";

0 commit comments

Comments
 (0)