That is hardly a fair example of error composition.
For starters, Number.parseInt should throw or be replaced with a throwing parseInt function (hiding the details).
As for the value > 3, we should not treat an error we raised ourselves! We should either have the caller deal with it or not throw at all: just use Math.min and be done with it.