Fixed error handling in st-query.