<div dir="ltr">Shoubik,<div><br></div><div>What if you have something like this:</div><div><br></div><div><span style="font-size:12.8px">e := models.NewInternalError("foo")</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Then NewInternalError() needs to be in the same package as simpleError in order to have access to the simpleError struct.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Here's what I mean: <a href="https://play.golang.org/p/BodnwGICn3">https://play.golang.org/p/BodnwGICn3</a></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Regards,</span></div><div><span style="font-size:12.8px">Konrad</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 24, 2016 at 1:34 PM, Shoubhik Bose <span dir="ltr"><<a href="mailto:shbose@redhat.com" target="_blank">shbose@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>.. but I'm not sure how that's supposed to work because if simpleError is non-exported, then this wouldn't work:<br><br>simpleErrorObj := models.NewSimpleError("foo")<br>e := models.InternalError{<wbr>simpleErrorObj}<br><br>"implicit assignment of unexported field 'simpleError' in models.InternalError literal"<br><br><br></div><div>- <br></div>Shoubhik<br><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 24, 2016 at 4:11 PM, Shoubhik Bose <span dir="ltr"><<a href="mailto:shbose@redhat.com" target="_blank">shbose@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span><div><div>Thanks Konrad and Thomas for your inputs:<br><br></div>Having a NewSimpleError(..) looks like a better short-term solution than maintaining multiple copies of errors.go<br></div><br></span>- <br></div>Shoubhik<br><div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Oct 24, 2016 at 2:21 PM, Thomas Mäder <span dir="ltr"><<a href="mailto:tmader@redhat.com" target="_blank">tmader@redhat.com</a>></span> wrote:<br></span><div><div class="m_-1717533455431710947h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>There is also
      <a class="m_-1717533455431710947m_3419992635104166052gmail-m_1414399213328690062moz-txt-link-freetext" href="https://github.com/almighty/almighty-core/issues/100" target="_blank">https://github.com/almighty/al<wbr>mighty-core/issues/100</a> related to
      this.<br>
    </p><div><div class="m_-1717533455431710947m_3419992635104166052gmail-h5">
    <br>
    <div class="m_-1717533455431710947m_3419992635104166052gmail-m_1414399213328690062moz-cite-prefix">On 10/24/2016 10:26 AM, Konrad Kleine
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Shoubik,
        <div><br>
        </div>
        <div>Thomas, Aslak and I discussed that at some point and one
          possible solution would be to construct errors with methods
          like NewSimpleError(), NewWhatEverError() that must be written
          first.</div>
        <div><br>
        </div>
        <div>I'm not sure what the outcome of our discussion was though.
          It didn't seem extremely important back then.</div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Konrad</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Oct 21, 2016 at 10:50 AM,
          Shoubhik Bose <span dir="ltr"><<a href="mailto:shbose@redhat.com" target="_blank">shbose@redhat.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">
              <div>
                <div>Hi folks,<br>
                  <br>
                </div>
                In alm-core we have error types defined inside
                models/errors.go<br>
                <a href="https://github.com/almighty/almighty-core/blob/master/models/errors.go" target="_blank">https://github.com/almighty/al<wbr>mighty-core/blob/master/models<wbr>/errors.go</a><br>
                <br>
                To construct an error we do a :<br>
                InternalError{<b>s</b>impleError{err.<span class="m_-1717533455431710947m_3419992635104166052gmail-m_1414399213328690062m_-1573449498360598407gmail-pl-c1"><wbr>Error</span>()}}<br>
                <br>
                which means that we can't access these outside the
                models package since simpleError is non-exported.<br>
                <br>
              </div>
              What would be the recommended approach for defining and
              using error types in other packages? <br>
              <br>
              Should the packages have their own errors.go , <br>
              or <br>
              should we modify models/errors.go to make it usable from
              outside?<br>
              <div>
                <div><br>
                  <br>
                  <br>
                  --<br>
                </div>
                <div>Shoubhik<br>
                </div>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            almighty-public mailing list<br>
            <a href="mailto:almighty-public@redhat.com" target="_blank">almighty-public@redhat.com</a><br>
            <a href="https://www.redhat.com/mailman/listinfo/almighty-public" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/almighty-public</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div></div></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>