public static function getErrors($template, array $options = array()) {
    $errors = array();
    foreach (self::getExpressions($template, $options) as $expression) {
        if (!$expression['valid']) {
            $errors[] = 'Malformed expression: "'.$expression['complete'].'" at offset '.$expression['offset'];
            continue;
        }
        try {
            $expression = self::parseExpression($expression['expression']);
            foreach ($expression['varspecs'] as $varspec) {
                try {
                    $varspec = self::parseVarspec($varspec);
                } catch (UriTemplateException $e) {
                    $errors[] = $e->getMessage();
                }
            }
        } catch (UriTemplateException $e) {
            $errors[] = $e->getMessage();
        }
    }
    return $errors;
}