Platform Overview

8 pages

func (a * App) CreateChannel (c * request.Context, channel * model.Channel, addMember bool) (*model.Channel, *model.AppError) { channel.DisplayName = strings. TrimSpace (channel.DisplayName) sc , nErr := a. Srv().Store. Channel (). Save (channel, * a. Config ().TeamSettings.MaxChannelsPerTeam) if nErr != nil { var invErr * store.ErrInvalidInput var cErr * store.ErrConflict var ltErr * store.ErrLimitExceeded var appErr * model.AppError switch { case errors. As (nErr, & invErr): switch { case invErr.Entity == "Channel" && invErr.Field == "DeleteAt" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save.archived_channel.app_error", ni l, "", http.StatusBadRequest) case invErr.Entity == "Channel" && invErr.Field == "Type" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save.direct_channel.app_error", nil, "", http. StatusBadRequest) case invErr.Entity == "Channel" && invErr.Field == "Id" : return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save_channel.existing.app_error", nil, "i d="+invErr.Value.(string), http.StatusBadRequest) } case errors. As (nErr, & cErr): return sc, model. NewAppError ( "CreateChannel" , store.ChannelExistsError, nil, cErr.Error(), http.StatusBadRequest) case errors. As (nErr, & ltErr): return nil , model. NewAppError ( "CreateChannel" , "store.sql_channel.save_channel.li mit.app_error", nil, ltErr.Error(), http.StatusBadRequest) case errors. As (nErr, & appErr): // in case we haven't converted to plain error. return nil , appErr default : // last fallback in case it doesn't map to an existing app error. return nil , model. NewAppError ( "CreateChannel" , "app.channel.create_channel.internal_er ror", nil, nErr.Error(), http.StatusInternalServerError) } } Make your work flow PLATFORM OVERVIEW An open source collaboration platform to help R&D teams align people, processes, and tools across the full software development lifecycle.

Platform Overview - Page 1 Platform Overview Page 2