# Custom type error message

**URL:** <https://discourse.dry-rb.org/t/custom-type-error-message/963>\
**Category:** dry-validation\
**Created:** [December 6, 2019, 12:04am UTC](https://discourse.dry-rb.org/t/custom-type-error-message/963 "2019-12-06T00:04:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabloh](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/pabloh/32/170_2.png) [@pabloh](https://discourse.dry-rb.org/u/pabloh)\
**Post date:** [December 6, 2019, 12:04am UTC](https://discourse.dry-rb.org/t/custom-type-error-message/963/1 "2019-12-06T00:04:49Z")

</div>

Hey guys I have a custom type that is defined like this:

```auto
TimeOfDay = Types::String.constrained(format: /\A\d{2}:\d{2}:\d{2}\z/i)

TypeContainer = Dry::Schema::TypeContainer.new
TypeContainer.register('params.time_of_day', TimeOfDay)

Schema = Dry::Schema.Params do
  config.types = TypeContainer
  required(:time).filled(:time_of_day)
end

```

They problem I’m having is that when I pass an invalid input I get `'is in invalid format'` as error and I would like something custom like `'is not a valid time of day'`, how can I change it for any schema field using that custom type?

---

<div class="post-metadata">

**Author:** ![flash-gordon](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/flash-gordon/32/494_2.png) [@flash-gordon](https://discourse.dry-rb.org/u/flash-gordon)\
**Post date:** [December 9, 2019, 10:11pm UTC](https://discourse.dry-rb.org/t/custom-type-error-message/963/2 "2019-12-09T22:11:49Z")

</div>

dry-schema doesn’t support custom messages for custom types. Use dry-validation + rules (macros) instead
