Skip to content

Commit

Permalink
refactor: ValueReference throws NotSupportedException if type is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Hertzole committed Jan 17, 2024
1 parent e0b188e commit 920e1b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private T GetValue()
$"Addressable asset is not loaded yet. Make sure you've called {nameof(LoadAddressableAssetAsync)} before trying to access the value.");
#endif
default:
throw new ArgumentOutOfRangeException(nameof(valueType), $"No supported value type for {valueType}.");
throw new NotSupportedException($"No supported value type for {valueType}.");
}
}

Expand All @@ -202,6 +202,8 @@ private void SetValue(in T value, in bool notify)
SetValueAddressable(value, notify);
break;
#endif
default:
throw new NotSupportedException($"No supported value type for {valueType}.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void InvalidType_Get()
{
TValue temp = instance.Value;
}
catch (ArgumentOutOfRangeException)
catch (NotSupportedException)
{
gotError = true;
}
Expand All @@ -247,7 +247,7 @@ public void InvalidType_Set()
{
instance.Value = MakeDifferentValue(default);
}
catch (ArgumentOutOfRangeException)
catch (NotSupportedException)
{
gotError = true;
}
Expand Down

0 comments on commit 920e1b6

Please sign in to comment.