mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-21 20:57:06 +02:00
perf: make exception an object
This commit is contained in:
parent
d6308e126c
commit
75d2be8803
@ -11,7 +11,7 @@ class IllegalValueException(val value: Any?) : Exception("Illegal value: $value"
|
||||
class InvalidTypeException(val got: String, val expected: String) :
|
||||
Exception("Invalid option value type: $got, expected $expected")
|
||||
|
||||
class RequirementNotMetException : Exception("null was passed into an option that requires a value")
|
||||
object RequirementNotMetException : Exception("null was passed into an option that requires a value")
|
||||
|
||||
/**
|
||||
* A registry for an array of [PatchOption]s.
|
||||
@ -79,7 +79,7 @@ sealed class PatchOption<T>(
|
||||
var value: T? = default
|
||||
set(value) {
|
||||
if (value == null && required) {
|
||||
throw RequirementNotMetException()
|
||||
throw RequirementNotMetException
|
||||
}
|
||||
if (!validator(value)) {
|
||||
throw IllegalValueException(value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user