Skip to content

Commit

Permalink
update the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
alpancs committed Aug 3, 2021
1 parent ac1a566 commit e4c9bf3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions response_builder.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"fmt"
"io"
"strings"
Expand Down Expand Up @@ -68,10 +69,8 @@ func (b responseBuilder) buildFile(reqFileName string) (*pluginpb.CodeGeneratorR

func (b responseBuilder) buildContent(protoFile *descriptorpb.FileDescriptorProto) (string, error) {
if len(protoFile.GetMessageType()) != 1 {
return "", fmt.Errorf(
"only one top-level type may be defined in the file \"%s\". use nested types instead (https://developers.google.com/protocol-buffers/docs/proto3#nested)",
protoFile.GetName(),
)
errorMessage := protoFile.GetName() + ": only one top-level type may be defined in a file. use nested types or use imports. see https://developers.google.com/protocol-buffers/docs/proto3 for details."
return "", errors.New(errorMessage)
}

contentBuilder := new(strings.Builder)
Expand Down

0 comments on commit e4c9bf3

Please sign in to comment.