\documentclass[a4paper]{article}

\usepackage{pgfplots}
\usepackage{pgfplots.assert}

\usepgfplotslibrary{patchplots}

\begin{document}
\def\pgfplotsERRORMESSAGE{}
\pgfkeys{
	/pgfplots/exception/invalid color component/.code 2 args={%
		\xdef\pgfplotsERRORMESSAGE{#2}%
	},%
}

\pgfplotscolornormalizesequence[colorspace=rgb]

\pgfplotscolornormalizesequencenext{rgb255=-1,0,0}
\pgfplotsassertequalstok{Sorry, the color component value -0.00392 (no. 0) is out of range. The allowed range is 0 <= value <= 1. The error occured near `rgb255=-1,0,0'}{\pgfplotsERRORMESSAGE}{}%

\def\pgfplotsERRORMESSAGE{}

% FAILS UTTERLY: confused with 'gray=...' : \pgfplotscolornormalizesequencenext{green}
\pgfplotscolornormalizesequencenext{blue}
\pgfplotsassertequalstok{Sorry, the color component value 'blue' is no number. Did you mean 'color=blue'? The error occured near `blue'}{\pgfplotsERRORMESSAGE}{}%



\def\pgfplotsERRORMESSAGE{}
	% non uniform spacing example: the mesh width is provided as first
% part of the specification.
	%\tracingmacros=2 \tracingcommands=2
\pgfplotsset{
	colormap=
		{violetnew}%
    	{[1cm] rgb255(0cm)=(25,25,122) color(1cm)=(yellow) rgb255(5cm)=(238,1140,238)}
}

	\pgfplotsassertequalstok{Sorry, the color component value 4.47052000000000 (no. 1) is out of range. The allowed range is 0 <= value <= 1. The error occured near `rgb255(5cm)=(238,1140,238)'}{\pgfplotsERRORMESSAGE}{}%
\end{document}

