refactor: use Error static function to generate BaseError stack trace