<?php
namespace nur\sery\schema;

use Exception;

class ValueException extends Exception {
  static final function invalid_kind(string $kind, $value, ?string $message=null): self {
    $invalid_kind = var_export($value, true).": invalid $kind";
    if ($message !== null) $invalid_kind .= ": $message";
    return new static($invalid_kind);
  }

  static final function invalid_key($value, ?string $message=null): self {
    return self::invalid_kind("key", $value, $message);
  }

  static final function invalid_value($value, ?string $message=null): self {
    return self::invalid_kind("value", $value, $message);
  }
}
