Improved syslog test to check error type before casting

Signed-off-by: Andrea Law <alaw@pivotallabs.com>