Only create error userInfo when it's necessary.