Wouldn't it be possible to you use warning.warn instead?